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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user