contrats and avenants_contrats added + modification of other entities
This commit is contained in:
parent
b75034739c
commit
250f21c6c2
@ -1,41 +1,42 @@
|
||||
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { Users } from "./user.entity";
|
||||
import {
|
||||
Entity, PrimaryColumn, Column, OneToOne, JoinColumn
|
||||
} from 'typeorm';
|
||||
import { Users } from './users.entity';
|
||||
|
||||
@Entity('assistantes_maternelles')
|
||||
export class AssistanteMaternelle {
|
||||
// Declarer les proprietes ici
|
||||
@PrimaryColumn('uuid')
|
||||
// PK = FK vers utilisateurs.id
|
||||
@PrimaryColumn('uuid', { name: 'id_utilisateur' })
|
||||
user_id: string;
|
||||
|
||||
@OneToOne(() => Users, user => user.assistanteMaternelle, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
@JoinColumn({ name: 'id_utilisateur', referencedColumnName: 'id' })
|
||||
user: Users;
|
||||
|
||||
@Column({type: 'varchar'})
|
||||
approval_number: string;
|
||||
@Column({ name: 'numero_agrement', length: 50, nullable: true })
|
||||
approval_number?: string;
|
||||
|
||||
@Column({type: 'date'})
|
||||
birthdate: Date;
|
||||
@Column({ name: 'date_naissance', type: 'date', nullable: true })
|
||||
birthdate?: Date;
|
||||
|
||||
@Column({type: 'varchar'})
|
||||
birthplace_city: string;
|
||||
@Column({ name: 'ville_naissance', length: 100, nullable: true })
|
||||
birthplace_city?: string;
|
||||
|
||||
@Column({type: 'varchar'})
|
||||
birthplace_country: string;
|
||||
@Column({ name: 'pays_naissance', length: 2, nullable: true })
|
||||
birthplace_country?: string;
|
||||
|
||||
@Column({type: 'text'})
|
||||
nir_encrypted: string;
|
||||
@Column({ name: 'nir_chiffre', length: 15, nullable: true })
|
||||
nir?: string;
|
||||
|
||||
@Column({type: 'int'})
|
||||
max_children: number;
|
||||
@Column({ name: 'nb_max_enfants', type: 'int', nullable: true })
|
||||
max_children?: number;
|
||||
|
||||
@Column({type: 'text'})
|
||||
bio: string;
|
||||
@Column({ name: 'biographie', type: 'text', nullable: true })
|
||||
biography?: string;
|
||||
|
||||
@Column({type: 'boolean', default: true})
|
||||
is_available: boolean;
|
||||
|
||||
@Column({type: 'varchar'})
|
||||
city: string;
|
||||
@Column({ name: 'disponible', type: 'boolean', default: true })
|
||||
available: boolean;
|
||||
|
||||
@Column({ name: 'ville_residence', length: 100, nullable: true })
|
||||
city?: string;
|
||||
}
|
||||
42
src/entities/avenants_contrats.entity.ts
Normal file
42
src/entities/avenants_contrats.entity.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
||||
import { Contrat } from "./contrats.entity";
|
||||
import { Users } from "./users.entity";
|
||||
|
||||
export enum StatutAvenantType {
|
||||
PROPOSE = 'propose',
|
||||
ACCEPTE = 'accepte',
|
||||
REFUSE = 'refuse',
|
||||
}
|
||||
|
||||
@Entity('avenants_contrats')
|
||||
export class AvenantContrat {
|
||||
// Define your columns and relationships here
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => Contrat, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'id_contrat' })
|
||||
contrat: Contrat;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true, name: 'modifications' })
|
||||
modifications?: any;
|
||||
|
||||
@ManyToOne(() => Users, { nullable: true })
|
||||
@JoinColumn({ name: 'initie_par', referencedColumnName: 'id' })
|
||||
initiator?: Users;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: StatutAvenantType,
|
||||
enumName: 'statut_avenant_type',
|
||||
default: StatutAvenantType.PROPOSE,
|
||||
name: 'statut'
|
||||
})
|
||||
statut: StatutAvenantType;
|
||||
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
||||
updatedAt: Date;
|
||||
}
|
||||
@ -1,60 +1,74 @@
|
||||
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";
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
OneToMany, ManyToMany, CreateDateColumn, JoinTable
|
||||
} 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'
|
||||
export enum StatutEnfantType {
|
||||
A_NAITRE = 'a_naitre',
|
||||
ACTIF = 'actif',
|
||||
SCOLARISE = 'scolarise',
|
||||
}
|
||||
|
||||
@Entity('children')
|
||||
export class Children {
|
||||
export enum GenreType {
|
||||
H = 'H',
|
||||
F = 'F',
|
||||
AUTRE = 'Autre',
|
||||
}
|
||||
|
||||
@Entity('enfants')
|
||||
export class Children {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: StatutEnfantType,
|
||||
enumName: 'statut_enfant_type',
|
||||
name: 'statut'
|
||||
})
|
||||
status: StatutEnfantType;
|
||||
|
||||
@Column({ name: 'prenom', length: 100 })
|
||||
first_name: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@Column({ name: 'nom', length: 100 })
|
||||
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,
|
||||
enum: GenreType,
|
||||
enumName: 'genre_type',
|
||||
nullable: true,
|
||||
name: 'genre'
|
||||
})
|
||||
status: ChildStatus;
|
||||
gender?: GenreType;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
@Column({ type: 'date', nullable: true, name: 'date_naissance' })
|
||||
birthdate?: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
@Column({ type: 'date', nullable: true, name: 'date_prevue_naissance' })
|
||||
due_date?: Date;
|
||||
|
||||
@OneToMany(() => ParentsChildren, pc => pc.child, { onDelete: 'CASCADE' })
|
||||
parentChildren: ParentsChildren[];
|
||||
@Column({ nullable: true, name: 'photo_url' })
|
||||
photo_url?: string;
|
||||
|
||||
@Column({ default: false, name: 'consentement_photo' })
|
||||
consent_photo: boolean;
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true, name: 'date_consentement_photo' })
|
||||
consent_photo_at?: Date;
|
||||
|
||||
@Column({ default: false, name: 'est_multiple' })
|
||||
is_multiple: boolean;
|
||||
|
||||
// Lien via table de jointure enfants_parents
|
||||
@OneToMany(() => ParentsChildren, pc => pc.child)
|
||||
parentLinks: ParentsChildren[];
|
||||
|
||||
// Relation avec Dossier
|
||||
@OneToMany(() => Dossier, d => d.child)
|
||||
dossiers: Dossier[];
|
||||
}
|
||||
|
||||
53
src/entities/contrats.entity.ts
Normal file
53
src/entities/contrats.entity.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import { Column, CreateDateColumn, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
||||
import { Dossier } from "./dossiers.entity";
|
||||
|
||||
export enum StatutContratType {
|
||||
BROUILLON = 'brouillon',
|
||||
EN_ATTENTE_SIGNATURE = 'en_attente_signature',
|
||||
VALIDE = 'valide',
|
||||
RESILIE = 'resilie',
|
||||
}
|
||||
|
||||
@Entity('contrats')
|
||||
export class Contrat {
|
||||
// Define your columns and relationships here
|
||||
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@OneToOne(() => Dossier, {onDelete: 'CASCADE'} )
|
||||
@JoinColumn({ name: 'id_dossier'})
|
||||
dossier: Dossier;
|
||||
|
||||
@Column({type: 'jsonb', nullable: true, name: 'planning'})
|
||||
planning?: any;
|
||||
|
||||
@Column({type: 'numeric', precision: 6, scale: 2, nullable: true, name: 'tarif_horaire'})
|
||||
hourly_rate?: string;
|
||||
|
||||
@Column({type: 'numeric', precision: 6, scale: 2, nullable: true, name: 'indemnites_repas'})
|
||||
meal_indemnity?: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: StatutContratType,
|
||||
default: StatutContratType.BROUILLON,
|
||||
name: 'statut'
|
||||
})
|
||||
statut: StatutContratType;
|
||||
|
||||
@Column({type: 'boolean', default: false, name: 'signe_parent'})
|
||||
signed_by_parent: boolean;
|
||||
|
||||
@Column({type: 'boolean', default: false, name: 'signe_am'})
|
||||
signed_by_am: boolean;
|
||||
|
||||
@Column({type: 'timestamptz', nullable: true, name: 'finalise_le'})
|
||||
finalized_at?: Date;
|
||||
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
created_at: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
||||
updated_at: Date;
|
||||
}
|
||||
@ -1,41 +1,60 @@
|
||||
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
||||
import { Parents } from "./parents.entity";
|
||||
import { Children } from "./children.entity";
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
ManyToOne, OneToMany, CreateDateColumn, UpdateDateColumn, JoinColumn
|
||||
} from 'typeorm';
|
||||
import { Parents } from './parents.entity';
|
||||
import { Children } from './children.entity';
|
||||
import { Message } from './messages.entity';
|
||||
|
||||
export enum StatutDossierType {
|
||||
ENVOYE = 'envoye',
|
||||
ACCEPTE = 'accepte',
|
||||
REFUSE = 'refuse',
|
||||
}
|
||||
|
||||
@Entity('dossiers')
|
||||
export class Dossier {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => Parents, p => p.dossiers, {onDelete: 'CASCADE'} )
|
||||
@JoinColumn({ name: 'parent_id', referencedColumnName: 'user_id' })
|
||||
@ManyToOne(() => Parents, p => p.dossiers, { onDelete: 'CASCADE', nullable: false })
|
||||
@JoinColumn({ name: 'id_parent', referencedColumnName: 'user_id' })
|
||||
parent: Parents;
|
||||
|
||||
@ManyToOne(() => Children, c => c.dossiers, {onDelete:'CASCADE'})
|
||||
@JoinColumn({ name: 'child_id', referencedColumnName: 'id' })
|
||||
@ManyToOne(() => Children, c => c.dossiers, { onDelete: 'CASCADE', nullable: false })
|
||||
@JoinColumn({ name: 'id_enfant', referencedColumnName: 'id' })
|
||||
child: Children;
|
||||
|
||||
@Column({type: 'text', nullable: true})
|
||||
presentation: string;
|
||||
@Column({ type: 'text', nullable: true, name: 'presentation' })
|
||||
presentation?: string;
|
||||
|
||||
@Column({type: 'varchar', nullable: true})
|
||||
type_contract: string;
|
||||
@Column({ type: 'varchar', length: 50, nullable: true, name: 'type_contrat' })
|
||||
type_contrat?: string;
|
||||
|
||||
@Column({type:'boolean', nullable: true})
|
||||
@Column({ type: 'boolean', default: false, name: 'repas' })
|
||||
meals: boolean;
|
||||
|
||||
@Column({type: 'decimal', nullable: true})
|
||||
budget: number;
|
||||
@Column({ type: 'numeric', precision: 10, scale: 2, nullable: true, name: 'budget' })
|
||||
budget?: number;
|
||||
|
||||
@Column({type: 'json', nullable: true})
|
||||
desired_schedule: any;
|
||||
@Column({ type: 'jsonb', nullable: true, name: 'planning_souhaite' })
|
||||
desired_schedule?: any;
|
||||
|
||||
@Column({type: 'varchar', default: 'sent'})
|
||||
status: string;
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: StatutDossierType,
|
||||
enumName: 'statut_dossier_type',
|
||||
default: StatutDossierType.ENVOYE,
|
||||
name: 'statut'
|
||||
})
|
||||
status: StatutDossierType;
|
||||
|
||||
@CreateDateColumn()
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
created_at: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
||||
updated_at: Date;
|
||||
|
||||
@OneToMany(() => Message, m => m.dossier)
|
||||
messages: Message[];
|
||||
}
|
||||
29
src/entities/messages.entity.ts
Normal file
29
src/entities/messages.entity.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
ManyToOne, JoinColumn, CreateDateColumn
|
||||
} from 'typeorm';
|
||||
import { Dossier } from './dossiers.entity';
|
||||
import { Users } from './users.entity';
|
||||
|
||||
@Entity('messages')
|
||||
export class Message {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@ManyToOne(() => Dossier, d => d.messages, { onDelete: 'CASCADE', nullable: false })
|
||||
@JoinColumn({ name: 'id_dossier' })
|
||||
dossier: Dossier;
|
||||
|
||||
@ManyToOne(() => Users, u => u.messages, { onDelete: 'CASCADE', nullable: false })
|
||||
@JoinColumn({ name: 'id_expediteur' })
|
||||
sender: Users;
|
||||
|
||||
@Column({ type: 'text', name: 'contenu' })
|
||||
content: string;
|
||||
|
||||
@Column({ type: 'boolean', name: 're_redige_par_ia', default: false })
|
||||
reRedigeParIA: boolean;
|
||||
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
created_at: Date;
|
||||
}
|
||||
@ -1,28 +1,31 @@
|
||||
import { Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { Users } from "./user.entity";
|
||||
import { ParentsChildren } from "./parents_children.entity";
|
||||
import { Dossier } from "./dossiers.entity";
|
||||
import {
|
||||
Entity, PrimaryColumn, OneToOne, JoinColumn,
|
||||
ManyToOne, OneToMany
|
||||
} from 'typeorm';
|
||||
import { Users } from './users.entity';
|
||||
import { ParentsChildren } from './parents_children.entity';
|
||||
import { Dossier } from './dossiers.entity';
|
||||
|
||||
@Entity('parents')
|
||||
export class Parents {
|
||||
|
||||
@PrimaryColumn('uuid')
|
||||
// PK = FK vers utilisateurs.id
|
||||
@PrimaryColumn('uuid', { name: 'id_utilisateur' })
|
||||
user_id: string;
|
||||
|
||||
@OneToOne(() => Users, user => user.parent, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
@JoinColumn({ name: 'id_utilisateur', referencedColumnName: 'id' })
|
||||
user: Users;
|
||||
|
||||
@Column({ type: 'uuid', nullable: true })
|
||||
co_parent_id?: string;
|
||||
|
||||
@OneToOne(() => Users)
|
||||
@JoinColumn({ name: 'co_parent_id' })
|
||||
// Co-parent (nullable) → FK vers utilisateurs.id
|
||||
@ManyToOne(() => Users, { nullable: true })
|
||||
@JoinColumn({ name: 'id_co_parent', referencedColumnName: 'id' })
|
||||
co_parent?: Users;
|
||||
|
||||
@OneToMany(() => ParentsChildren, pc => pc.parent, { onDelete: 'CASCADE' })
|
||||
// Lien vers enfants via la table enfants_parents
|
||||
@OneToMany(() => ParentsChildren, pc => pc.parent)
|
||||
parentChildren: ParentsChildren[];
|
||||
|
||||
// Lien vers les dossiers de ce parent
|
||||
@OneToMany(() => Dossier, d => d.parent)
|
||||
dossiers: Dossier[];
|
||||
}
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
import { Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Parents } from "./parents.entity";
|
||||
import { Children } from "./children.entity";
|
||||
import {
|
||||
Entity, ManyToOne, JoinColumn, PrimaryColumn
|
||||
} from 'typeorm';
|
||||
import { Parents } from './parents.entity';
|
||||
import { Children } from './children.entity';
|
||||
|
||||
@Entity('parents_children')
|
||||
@Entity('enfants_parents')
|
||||
export class ParentsChildren {
|
||||
@PrimaryColumn('uuid', { name: 'id_parent' })
|
||||
id_parent: string;
|
||||
|
||||
@PrimaryColumn('uuid')
|
||||
parent_id: string;
|
||||
@PrimaryColumn('uuid', { name: 'id_enfant' })
|
||||
id_enfant: string;
|
||||
|
||||
@PrimaryColumn('uuid')
|
||||
child_id: string;
|
||||
|
||||
@ManyToOne(() => Parents, (parent) => parent.parentChildren, {onDelete: 'CASCADE'})
|
||||
@JoinColumn({ name: 'parent_id', referencedColumnName: 'user_id' })
|
||||
@ManyToOne(() => Parents, p => p.parentChildren, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'id_parent', referencedColumnName: 'user_id' })
|
||||
parent: Parents;
|
||||
|
||||
@ManyToOne(() => Children, (child) => child.parentChildren, {onDelete: 'CASCADE'})
|
||||
@JoinColumn({ name: 'child_id', referencedColumnName: 'id' })
|
||||
@ManyToOne(() => Children, c => c.parentLinks, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'id_enfant', referencedColumnName: 'id' })
|
||||
child: Children;
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
CreateDateColumn, UpdateDateColumn,
|
||||
OneToOne
|
||||
} from 'typeorm';
|
||||
import { AssistanteMaternelle } from './assistantes_maternelles.entity';
|
||||
import { Parents } from './parents.entity';
|
||||
export enum UserRole {
|
||||
PARENT = 'PARENT',
|
||||
ASSISTANT = 'ASSISTANT',
|
||||
GESTIONNAIRE = 'GESTIONNAIRE',
|
||||
ADMIN = 'ADMIN',
|
||||
}
|
||||
|
||||
@Entity('users')
|
||||
export class Users {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ unique: true })
|
||||
email: string;
|
||||
|
||||
@Column()
|
||||
password_hash: string;
|
||||
|
||||
@Column()
|
||||
first_name: string;
|
||||
|
||||
@Column()
|
||||
last_name: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: UserRole,
|
||||
default: UserRole.PARENT,
|
||||
})
|
||||
role: UserRole;
|
||||
|
||||
@Column({ default: 'pending' })
|
||||
status: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
phone: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
address: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
photo_url: string;
|
||||
|
||||
@Column({ default: false })
|
||||
consent_photo: boolean;
|
||||
|
||||
@Column({ type: 'timestamp', nullable: true })
|
||||
consent_photo_at: Date;
|
||||
|
||||
@Column({ default: false })
|
||||
must_change_password: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
|
||||
@OneToOne(() => AssistanteMaternelle, a => a.user)
|
||||
assistanteMaternelle?: AssistanteMaternelle;
|
||||
|
||||
@OneToOne(() => Parents, p => p.user)
|
||||
parent?: Parents;
|
||||
|
||||
}
|
||||
|
||||
106
src/entities/users.entity.ts
Normal file
106
src/entities/users.entity.ts
Normal file
@ -0,0 +1,106 @@
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
CreateDateColumn, UpdateDateColumn,
|
||||
OneToOne, OneToMany
|
||||
} from 'typeorm';
|
||||
import { AssistanteMaternelle } from './assistantes_maternelles.entity';
|
||||
import { Parents } from './parents.entity';
|
||||
import { Message } from './messages.entity';
|
||||
|
||||
// Enums alignés avec la BDD PostgreSQL
|
||||
export enum RoleType {
|
||||
PARENT = 'parent',
|
||||
GESTIONNAIRE = 'gestionnaire',
|
||||
SUPER_ADMIN = 'super_admin',
|
||||
ASSISTANTE_MATERNELLE = 'assistante_maternelle',
|
||||
}
|
||||
|
||||
export enum GenreType {
|
||||
H = 'H',
|
||||
F = 'F',
|
||||
AUTRE = 'Autre',
|
||||
}
|
||||
|
||||
export enum StatutUtilisateurType {
|
||||
EN_ATTENTE = 'en_attente',
|
||||
ACTIF = 'actif',
|
||||
SUSPENDU = 'suspendu',
|
||||
}
|
||||
|
||||
@Entity('utilisateurs')
|
||||
export class Users {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ unique: true, name: 'courriel' })
|
||||
email: string;
|
||||
|
||||
@Column({ name: 'mot_de_passe_hash' })
|
||||
password_hash: string;
|
||||
|
||||
@Column({ name: 'prenom', nullable: true })
|
||||
first_name: string;
|
||||
|
||||
@Column({ name: 'nom', nullable: true })
|
||||
last_name: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: GenreType,
|
||||
enumName: 'genre_type', // correspond à l'enum SQL
|
||||
nullable: true,
|
||||
name: 'genre'
|
||||
})
|
||||
gender?: GenreType;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: RoleType,
|
||||
enumName: 'role_type',
|
||||
name: 'role'
|
||||
})
|
||||
role: RoleType;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: StatutUtilisateurType,
|
||||
enumName: 'statut_utilisateur_type',
|
||||
default: StatutUtilisateurType.EN_ATTENTE,
|
||||
name: 'statut'
|
||||
})
|
||||
status: StatutUtilisateurType;
|
||||
|
||||
@Column({ nullable: true, name: 'telephone' })
|
||||
phone?: string;
|
||||
|
||||
@Column({ nullable: true, name: 'adresse' })
|
||||
address?: string;
|
||||
|
||||
@Column({ nullable: true, name: 'photo_url' })
|
||||
photo_url?: string;
|
||||
|
||||
@Column({ default: false, name: 'consentement_photo' })
|
||||
consent_photo: boolean;
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true, name: 'date_consentement_photo' })
|
||||
consent_photo_at?: Date;
|
||||
|
||||
@Column({ default: false, name: 'changement_mdp_obligatoire' })
|
||||
must_change_password: boolean;
|
||||
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
created_at: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
||||
updated_at: Date;
|
||||
|
||||
// Relations
|
||||
@OneToOne(() => AssistanteMaternelle, a => a.user)
|
||||
assistanteMaternelle?: AssistanteMaternelle;
|
||||
|
||||
@OneToOne(() => Parents, p => p.user)
|
||||
parent?: Parents;
|
||||
|
||||
@OneToMany(() => Message, m => m.sender)
|
||||
messages?: Message[];
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user