61 lines
1.4 KiB
TypeScript

import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Parents } from "./parents.entity";
import { ParentsChildren } from "./parents_children.entity";
import { Dossier } from "./dossiers.entity";
export enum ChildStatus {
A_NAITRE = 'A_NAÎTRE',
ACTIF = 'ACTIF',
SCOLARISE = 'SCOLARISE'
}
@Entity('children')
export class Children {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ nullable: true })
first_name: string;
@Column({ nullable: true })
last_name: string;
@Column({ type: 'date', nullable: true })
birthdate: Date;
@Column({ type: 'date', nullable: true })
due_date: Date;
@Column({ nullable: true })
photo_url: string;
@Column({ nullable: true })
consent_photo: boolean;
@Column({ type: 'timestamp', nullable: true })
consent_photo_at: Date;
@Column({nullable: true })
is_multiple: boolean
@Column({
type: 'enum',
enum: ChildStatus,
default: ChildStatus.A_NAITRE,
})
status: ChildStatus;
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn()
updated_at: Date;
@OneToMany(() => ParentsChildren, pc => pc.child, { onDelete: 'CASCADE' })
parentChildren: ParentsChildren[];
@OneToMany(() => Dossier, d => d.child)
dossiers: Dossier[];
}