fix(#138): lire le consentement photo sans heuristique photo.

Admin et reprise utilisentent uniquement la valeur API ; plus de
pré-cochage implicite si une photo est présente.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
MARTIN Julien 2026-07-17 12:46:54 +02:00
parent 59919834b9
commit 291ea26b34
3 changed files with 4 additions and 13 deletions

View File

@ -49,10 +49,7 @@ class EnfantAdminModel {
}
final photoUrl = json['photo_url'] as String? ?? json['photoUrl'] as String?;
final hasPhoto = (photoUrl ?? '').trim().isNotEmpty;
// L'inscription parent exigeait le consentement pour envoyer la photo, mais
// le back a longtemps forcé consent_photo=false (voir reprise_mapper).
final consentFromApi = _parseBool(json['consent_photo']) ||
final consentPhoto = _parseBool(json['consent_photo']) ||
_parseBool(json['consentement_photo']) ||
_parseBool(json['consentPhoto']);
@ -67,7 +64,7 @@ class EnfantAdminModel {
(json['status'] ?? json['statut'])?.toString(),
),
photoUrl: photoUrl,
consentPhoto: consentFromApi || hasPhoto,
consentPhoto: consentPhoto,
isMultiple: _parseBool(json['is_multiple']) ||
_parseBool(json['est_multiple']),
parentLinks: links,

View File

@ -199,9 +199,6 @@ class ParentRegistrationPayload {
map['photo_base64'] = photo.$1;
map['photo_filename'] = photo.$2;
}
// Consentement photo enfant (le back l'ignore encore à l'inscription
// à brancher côté API ; en attendant le front admin infère via photo).
map['consent_photo'] = c.photoConsent;
return map;
}

View File

@ -38,15 +38,12 @@ class RepriseMapper {
? isoToDdMmYyyy(e.dueDate)
: isoToDdMmYyyy(e.birthDate);
final photo = e.photoUrl?.trim();
final hasPhoto = photo != null && photo.isNotEmpty;
return ChildData(
firstName: e.firstName ?? '',
lastName: e.lastName ?? '',
dob: dob,
genre: e.gender ?? '',
// Legacy : dossiers inscrits avant #144 avaient consent_photo=false malgré une photo.
// On pré-coche encore si photo en base pour ne pas bloquer la reprise.
photoConsent: e.consentPhoto || hasPhoto,
photoConsent: e.consentPhoto,
multipleBirth: e.estMultiple,
isUnbornChild: isUnborn,
cardColor: _childCardColors[index % _childCardColors.length],
@ -200,7 +197,7 @@ class RepriseMapper {
postalCode: dossier.codePostal ?? '',
city: dossier.ville ?? '',
existingPhotoUrl: displayPhoto,
consentementPhoto: dossier.consentementPhoto || hasPhoto,
consentementPhoto: dossier.consentementPhoto,
dateOfBirth: parseIsoDate(dossier.dateNaissance),
birthCity: dossier.lieuNaissanceVille ?? '',
birthCountry: dossier.lieuNaissancePays ?? '',