feat(#132): photo à la création enfant staff (multipart + bools).

Transform "true"/"false" pour class-validator ; multipart staff
avec FileInterceptor('photo') inchangé côté stockage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-17 18:08:52 +02:00
co-authored by Cursor
parent 26e9738ec7
commit f7ac628445
3 changed files with 26 additions and 6 deletions
@@ -58,8 +58,8 @@ const photoMulterOptions = {
};
/**
* Multer uniquement si Content-Type multipart (parcours parent).
* Les appels staff JSON (#132) passent sans interceptor fichier.
* Multer uniquement si Content-Type multipart (parent ou staff + photo).
* JSON sans photo (#132) passe sans interceptor fichier.
*/
@Injectable()
class OptionalEnfantPhotoInterceptor implements NestInterceptor {
@@ -96,10 +96,15 @@ export class EnfantsController {
@ApiOperation({
summary: 'Créer un enfant',
description:
'PARENT : multipart éventuel, rattache au compte connecté. Staff : JSON + parent_user_id (foyer). Ticket #132.',
'PARENT : multipart éventuel, rattache au compte connecté. ' +
'Staff : parent_user_id obligatoire ; JSON sans photo OK ; avec photo → multipart (champ fichier `photo`, max 5 Mo). Ticket #132.',
})
@ApiConsumes('application/json', 'multipart/form-data')
@ApiBody({ type: CreateEnfantsDto })
@ApiBody({
description:
'Champs métier (+ parent_user_id côté staff). Fichier optionnel `photo` en multipart.',
type: CreateEnfantsDto,
})
@UseInterceptors(OptionalEnfantPhotoInterceptor)
create(
@Body() dto: CreateEnfantsDto,