merge: fix upload documents légaux (#126)
This commit is contained in:
commit
25b5e0dd93
@ -32,8 +32,9 @@ COPY --from=builder /app/dist ./dist
|
|||||||
RUN addgroup -g 1001 -S nodejs
|
RUN addgroup -g 1001 -S nodejs
|
||||||
RUN adduser -S nestjs -u 1001
|
RUN adduser -S nestjs -u 1001
|
||||||
|
|
||||||
# Créer le dossier uploads et donner les permissions
|
# Dossiers écriture runtime (nestjs non-root) : photos + documents légaux (PDF)
|
||||||
RUN mkdir -p /app/uploads/photos && chown -R nestjs:nodejs /app/uploads
|
RUN mkdir -p /app/uploads/photos /app/documents/legaux && \
|
||||||
|
chown -R nestjs:nodejs /app/uploads /app/documents
|
||||||
|
|
||||||
USER nestjs
|
USER nestjs
|
||||||
|
|
||||||
|
|||||||
@ -101,8 +101,9 @@ export class DocumentsLegauxController {
|
|||||||
throw new BadRequestException('Aucun fichier fourni');
|
throw new BadRequestException('Aucun fichier fourni');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Récupérer l'ID utilisateur depuis le guard
|
// TODO: Récupérer l'ID utilisateur depuis le guard quand l'auth sera branchée.
|
||||||
const userId = '00000000-0000-0000-0000-000000000000'; // Temporaire
|
// En attendant, on n'associe pas d'utilisateur plutôt que d'envoyer un UUID fictif invalide.
|
||||||
|
const userId: string | null = null;
|
||||||
|
|
||||||
const document = await this.documentsService.uploadNouvelleVersion(
|
const document = await this.documentsService.uploadNouvelleVersion(
|
||||||
uploadDto.type,
|
uploadDto.type,
|
||||||
|
|||||||
@ -43,7 +43,7 @@ export class DocumentsLegauxService {
|
|||||||
async uploadNouvelleVersion(
|
async uploadNouvelleVersion(
|
||||||
type: 'cgu' | 'privacy',
|
type: 'cgu' | 'privacy',
|
||||||
file: Express.Multer.File,
|
file: Express.Multer.File,
|
||||||
userId: string,
|
userId?: string | null,
|
||||||
): Promise<DocumentLegal> {
|
): Promise<DocumentLegal> {
|
||||||
// Validation du type de fichier
|
// Validation du type de fichier
|
||||||
if (file.mimetype !== 'application/pdf') {
|
if (file.mimetype !== 'application/pdf') {
|
||||||
@ -84,7 +84,7 @@ export class DocumentsLegauxService {
|
|||||||
fichier_path: filePath,
|
fichier_path: filePath,
|
||||||
fichier_hash: hash,
|
fichier_hash: hash,
|
||||||
actif: false, // Pas actif par défaut
|
actif: false, // Pas actif par défaut
|
||||||
televersePar: { id: userId } as any,
|
televersePar: userId ? ({ id: userId } as any) : null,
|
||||||
televerseLe: new Date(),
|
televerseLe: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,8 @@ services:
|
|||||||
UPLOAD_PHOTOS_DIR: ${UPLOAD_PHOTOS_DIR:-/app/uploads/photos}
|
UPLOAD_PHOTOS_DIR: ${UPLOAD_PHOTOS_DIR:-/app/uploads/photos}
|
||||||
volumes:
|
volumes:
|
||||||
- backend_uploads:/app/uploads/photos
|
- backend_uploads:/app/uploads/photos
|
||||||
|
# PDF CGU / privacy (upload admin) — persistance entre redémarrages
|
||||||
|
- backend_documents_legaux:/app/documents/legaux
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
labels:
|
labels:
|
||||||
@ -105,6 +107,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
backend_uploads:
|
backend_uploads:
|
||||||
|
backend_documents_legaux:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
ptitspas_network:
|
ptitspas_network:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user