Skip to content

Commit e603d06

Browse files
committed
[CORRECTION][PRO CONNECT] Persiste le siret lors de la création du compte Aidant pour les Gendarmes
1 parent f8dfd22 commit e603d06

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

mon-aide-cyber-api/src/infrastructure/entrepots/postgres/EntrepotAidantPostgres.ts

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type DonneesAidant = {
2323
preferences: PreferencesDTO;
2424
consentementAnnuaire: boolean;
2525
dateSignatureCGU?: string;
26+
siret?: string;
2627
};
2728

2829
type AidantDTO = DTO & {
@@ -69,6 +70,7 @@ export class EntrepotAidantPostgres
6970
dto.donnees.dateSignatureCGU
7071
),
7172
}),
73+
...(dto.donnees.siret && { siret: dto.donnees.siret }),
7274
};
7375
}
7476

@@ -89,6 +91,7 @@ export class EntrepotAidantPostgres
8991
...(entite.dateSignatureCGU && {
9092
dateSignatureCGU: entite.dateSignatureCGU.toISOString(),
9193
}),
94+
...(entite.siret && { siret: entite.siret }),
9295
},
9396
};
9497
}

mon-aide-cyber-api/test/infrastructure/entrepots/postgres/EntrepotsPostgres.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,23 @@ describe('Entrepot Aidant', () => {
563563
expect(aidantRecu).toStrictEqual<Aidant>(aidant);
564564
});
565565

566+
it('Persiste un aidant avec son Siret', async () => {
567+
const aidant = unAidant().avecUnSiret('1234567890').construis();
568+
const serviceDeChiffrement = new FauxServiceDeChiffrement(
569+
new Map([
570+
[aidant.email, 'aaa'],
571+
[aidant.nomPrenom, 'ccc'],
572+
])
573+
);
574+
575+
await new EntrepotAidantPostgres(serviceDeChiffrement).persiste(aidant);
576+
577+
const aidantRecu = await new EntrepotAidantPostgres(
578+
serviceDeChiffrement
579+
).lis(aidant.identifiant);
580+
expect(aidantRecu).toStrictEqual<Aidant>(aidant);
581+
});
582+
566583
it('Met à jour le consentement pour apparaître dans l’annuaire', async () => {
567584
const aidant = unAidant().construis();
568585
const serviceDeChiffrement = new ServiceDeChiffrementClair();

0 commit comments

Comments
 (0)