- Dossiers unifiés #119, pending-families enrichi, validation admin (wizards) - Front: modèles dossier_unifie / pending_family, NIR, auth - Migrations dossier_famille, scripts de test API - Résolution conflits: parents.*, docs tickets, auth_service, nir_utils Made-with: Cursor
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
ManyToOne,
|
|
OneToMany,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
JoinColumn,
|
|
} from 'typeorm';
|
|
import { Parents } from './parents.entity';
|
|
import { Children } from './children.entity';
|
|
import { StatutDossierType } from './dossiers.entity';
|
|
|
|
/** Un dossier = une famille, N enfants (texte de motivation unique, liste d'enfants). */
|
|
@Entity('dossier_famille')
|
|
export class DossierFamille {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'numero_dossier', length: 20 })
|
|
numero_dossier: string;
|
|
|
|
@ManyToOne(() => Parents, { onDelete: 'CASCADE', nullable: false })
|
|
@JoinColumn({ name: 'id_parent', referencedColumnName: 'user_id' })
|
|
parent: Parents;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
presentation?: string;
|
|
|
|
@Column({
|
|
type: 'enum',
|
|
enum: StatutDossierType,
|
|
enumName: 'statut_dossier_type',
|
|
default: StatutDossierType.ENVOYE,
|
|
name: 'statut',
|
|
})
|
|
statut: StatutDossierType;
|
|
|
|
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
|
cree_le: Date;
|
|
|
|
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
|
modifie_le: Date;
|
|
|
|
@OneToMany(() => DossierFamilleEnfant, (dfe) => dfe.dossier_famille)
|
|
enfants: DossierFamilleEnfant[];
|
|
}
|
|
|
|
@Entity('dossier_famille_enfants')
|
|
export class DossierFamilleEnfant {
|
|
@Column({ name: 'id_dossier_famille', primary: true })
|
|
id_dossier_famille: string;
|
|
|
|
@Column({ name: 'id_enfant', primary: true })
|
|
id_enfant: string;
|
|
|
|
@ManyToOne(() => DossierFamille, (df) => df.enfants, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_dossier_famille' })
|
|
dossier_famille: DossierFamille;
|
|
|
|
@ManyToOne(() => Children, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_enfant' })
|
|
enfant: Children;
|
|
}
|