fix(auth): inscription AM — persister photo si photo_base64 sans photo_filename (#120)
- Défaut nom fichier photo_am.jpg ; extension finale dérivée du data-URL - Swagger DTO + description endpoint register/am Made-with: Cursor
This commit is contained in:
parent
eac108c9f4
commit
d69768806c
@ -59,7 +59,8 @@ export class AuthController {
|
|||||||
@Post('register/am')
|
@Post('register/am')
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
summary: 'Inscription Assistante Maternelle COMPLÈTE',
|
summary: 'Inscription Assistante Maternelle COMPLÈTE',
|
||||||
description: 'Crée User AM + entrée assistantes_maternelles (identité + infos pro + photo + CGU) en une transaction',
|
description:
|
||||||
|
'Crée User AM + entrée assistantes_maternelles (identité + infos pro + photo + CGU) en une transaction. Si photo_base64 est fourni sans photo_filename, le serveur utilise le nom par défaut photo_am.jpg (extension du fichier stocké = type du data-URL).',
|
||||||
})
|
})
|
||||||
@ApiResponse({ status: 201, description: 'Inscription réussie - Dossier en attente de validation' })
|
@ApiResponse({ status: 201, description: 'Inscription réussie - Dossier en attente de validation' })
|
||||||
@ApiResponse({ status: 400, description: 'Données invalides ou CGU non acceptées' })
|
@ApiResponse({ status: 400, description: 'Données invalides ou CGU non acceptées' })
|
||||||
|
|||||||
@ -465,8 +465,11 @@ export class AuthService {
|
|||||||
dateExpiration.setDate(dateExpiration.getDate() + joursExpirationToken);
|
dateExpiration.setDate(dateExpiration.getDate() + joursExpirationToken);
|
||||||
|
|
||||||
let urlPhoto: string | null = null;
|
let urlPhoto: string | null = null;
|
||||||
if (dto.photo_base64 && dto.photo_filename) {
|
const photoB64 = (dto.photo_base64 ?? '').trim();
|
||||||
urlPhoto = await this.sauvegarderPhotoDepuisBase64(dto.photo_base64, dto.photo_filename);
|
if (photoB64) {
|
||||||
|
const nomFichier =
|
||||||
|
(dto.photo_filename ?? '').trim() || 'photo_am.jpg';
|
||||||
|
urlPhoto = await this.sauvegarderPhotoDepuisBase64(photoB64, nomFichier);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dateConsentementPhoto =
|
const dateConsentementPhoto =
|
||||||
|
|||||||
@ -76,7 +76,12 @@ export class RegisterAMCompletDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
photo_base64?: string;
|
photo_base64?: string;
|
||||||
|
|
||||||
@ApiProperty({ example: 'photo_profil.jpg', required: false })
|
@ApiProperty({
|
||||||
|
example: 'photo_profil.jpg',
|
||||||
|
required: false,
|
||||||
|
description:
|
||||||
|
'Nom du fichier photo (optionnel si photo_base64 est fourni ; défaut serveur : photo_am.jpg). L’extension réelle du fichier stocké suit le type MIME du data-URL.',
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
photo_filename?: string;
|
photo_filename?: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user