feat(#135): mode édition dossier + ajout co-parent (squash develop).

Wizard edit famille/AM, POST co-parent, PATCH enfants avec photo.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-08 17:32:06 +02:00
co-authored by Cursor
parent 84e46162fd
commit ea0e97d930
15 changed files with 1246 additions and 69 deletions
+13 -1
View File
@@ -195,7 +195,12 @@ export class EnfantsService {
// Mise à jour
async update(id: string, dto: Partial<CreateEnfantsDto>, currentUser: Users): Promise<Children> {
async update(
id: string,
dto: Partial<CreateEnfantsDto>,
currentUser: Users,
photoFile?: Express.Multer.File,
): Promise<Children> {
const child = await this.childrenRepository.findOne({ where: { id } });
if (!child) throw new NotFoundException('Enfant introuvable');
@@ -205,6 +210,13 @@ export class EnfantsService {
patch.consent_photo = dto.consent_photo;
patch.consent_photo_at = dto.consent_photo ? new Date() : null!;
}
if (photoFile) {
patch.photo_url = `/uploads/photos/${photoFile.filename}`;
if (dto.consent_photo !== false) {
patch.consent_photo = true;
patch.consent_photo_at = new Date();
}
}
await this.childrenRepository.update(id, patch);
return this.findOne(id, currentUser);