diff --git a/backend/src/entities/parents.entity.ts b/backend/src/entities/parents.entity.ts index 7b33389..ea1db0e 100644 --- a/backend/src/entities/parents.entity.ts +++ b/backend/src/entities/parents.entity.ts @@ -28,14 +28,14 @@ export class Parents { /** * Placement AM↔enfant sélectionné sur le TdB parent (couple actif) — ticket #168. - * Null = le front prend le premier couple actif retourné par l’API. + * Null / absent = le front prend le premier couple actif retourné par l’API. */ @Column({ name: 'id_placement_garde_courant', type: 'uuid', nullable: true }) - id_placement_garde_courant?: string | null; + id_placement_garde_courant?: string; @ManyToOne(() => AmChildren, { nullable: true, onDelete: 'SET NULL' }) @JoinColumn({ name: 'id_placement_garde_courant', referencedColumnName: 'id' }) - placement_garde_courant?: AmChildren | null; + placement_garde_courant?: AmChildren; // Lien vers enfants via la table enfants_parents @OneToMany(() => ParentsChildren, pc => pc.parent) diff --git a/backend/src/routes/parents/parents.service.ts b/backend/src/routes/parents/parents.service.ts index 912e998..c1205b0 100644 --- a/backend/src/routes/parents/parents.service.ts +++ b/backend/src/routes/parents/parents.service.ts @@ -543,7 +543,7 @@ export class ParentsService { idCourant = null; await this.parentsRepository.update( { user_id: parentUserId }, - { id_placement_garde_courant: null }, + { id_placement_garde_courant: () => 'NULL' }, ); } if (!idCourant && placements.length === 1) {