feat(backend): API documents légaux #31
- Création DTOs (UploadDocumentDto, DocumentsActifsResponseDto, DocumentVersionDto) - Création DocumentsLegauxController avec 6 endpoints: * GET /documents-legaux/actifs (public) * GET /documents-legaux/:type/versions (admin) * POST /documents-legaux (upload, admin) * PATCH /documents-legaux/:id/activer (admin) * GET /documents-legaux/:id/download (public) * GET /documents-legaux/:id/verifier-integrite (admin) - Support upload multipart/form-data avec FileInterceptor - Validation des types (cgu/privacy) - Stream PDF pour téléchargement - Intégration dans DocumentsLegauxModule - Compilation OK TODO: Ajouter guards auth (JwtAuthGuard, RolesGuard) Réf: docs/22_DOCUMENTS-LEGAUX.md
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export class DocumentVersionDto {
|
||||
id: string;
|
||||
version: number;
|
||||
fichier_nom: string;
|
||||
actif: boolean;
|
||||
televersePar: {
|
||||
id: string;
|
||||
prenom?: string;
|
||||
nom?: string;
|
||||
} | null;
|
||||
televerseLe: Date;
|
||||
activeLe: Date | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export class DocumentActifDto {
|
||||
id: string;
|
||||
type: 'cgu' | 'privacy';
|
||||
version: number;
|
||||
url: string;
|
||||
activeLe: Date | null;
|
||||
}
|
||||
|
||||
export class DocumentsActifsResponseDto {
|
||||
cgu: DocumentActifDto;
|
||||
privacy: DocumentActifDto;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { IsEnum, IsNotEmpty } from 'class-validator';
|
||||
|
||||
export class UploadDocumentDto {
|
||||
@IsEnum(['cgu', 'privacy'], { message: 'Le type doit être "cgu" ou "privacy"' })
|
||||
@IsNotEmpty({ message: 'Le type est requis' })
|
||||
type: 'cgu' | 'privacy';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user