fix(documents-legaux): éviter 500 upload sans utilisateur valide (#126)

Ne plus associer televersePar à un UUID fictif inexistant ; laisser null tant que l’auth n’est pas branchée sur l’endpoint d’upload.

Made-with: Cursor
This commit is contained in:
2026-04-17 13:33:36 +02:00
parent b0594c32e7
commit d8a81a56ae
2 changed files with 5 additions and 4 deletions
@@ -43,7 +43,7 @@ export class DocumentsLegauxService {
async uploadNouvelleVersion(
type: 'cgu' | 'privacy',
file: Express.Multer.File,
userId: string,
userId?: string | null,
): Promise<DocumentLegal> {
// Validation du type de fichier
if (file.mimetype !== 'application/pdf') {
@@ -84,7 +84,7 @@ export class DocumentsLegauxService {
fichier_path: filePath,
fichier_hash: hash,
actif: false, // Pas actif par défaut
televersePar: { id: userId } as any,
televersePar: userId ? ({ id: userId } as any) : null,
televerseLe: new Date(),
});