Squash merge develop → master. - Fiche parent éditable (co-parent, PATCH fiche, GET /parents) - Fiche AM 3 onglets (PATCH fiche, rattacher/détacher enfants) - Table enfants_assistantes_maternelles + enum garde/sans_garde - Migration SQL + BDD.sql canonique - Correctifs recette : @Get() parents, DTO fiche AM, fix NIR Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
CreateDateColumn,
|
|
} from 'typeorm';
|
|
import { AssistanteMaternelle } from './assistantes_maternelles.entity';
|
|
import { Children } from './children.entity';
|
|
import { Users } from './users.entity';
|
|
|
|
@Entity('enfants_assistantes_maternelles', { schema: 'public' })
|
|
export class AmChildren {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'id_am', type: 'uuid' })
|
|
amId: string;
|
|
|
|
@Column({ name: 'id_enfant', type: 'uuid' })
|
|
enfantId: string;
|
|
|
|
@Column({ name: 'date_debut', type: 'date' })
|
|
date_debut: Date;
|
|
|
|
@Column({ name: 'date_fin', type: 'date', nullable: true })
|
|
date_fin?: Date;
|
|
|
|
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
|
cree_le: Date;
|
|
|
|
@Column({ name: 'cree_par', type: 'uuid', nullable: true })
|
|
cree_par?: string;
|
|
|
|
@ManyToOne(() => AssistanteMaternelle, (am) => am.amChildren, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_am', referencedColumnName: 'user_id' })
|
|
am: AssistanteMaternelle;
|
|
|
|
@ManyToOne(() => Children, (c) => c.amLinks, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'id_enfant', referencedColumnName: 'id' })
|
|
child: Children;
|
|
|
|
@ManyToOne(() => Users, { nullable: true, onDelete: 'SET NULL' })
|
|
@JoinColumn({ name: 'cree_par', referencedColumnName: 'id' })
|
|
createdBy?: Users;
|
|
}
|