feat(backend): implement Relais module and relation with Gestionnaire (Ticket #94)
- Create Relais entity - Create Relais module, controller, service with CRUD - Update Users entity with ManyToOne relation to Relais - Update GestionnairesService to handle relaisId Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, OneToMany } from 'typeorm';
|
||||
import { Users } from './users.entity';
|
||||
|
||||
@Entity('relais', { schema: 'public' })
|
||||
export class Relais {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ name: 'nom' })
|
||||
nom: string;
|
||||
|
||||
@Column({ name: 'adresse' })
|
||||
adresse: string;
|
||||
|
||||
@Column({ type: 'jsonb', name: 'horaires_ouverture', nullable: true })
|
||||
horaires_ouverture?: any;
|
||||
|
||||
@Column({ name: 'ligne_fixe', nullable: true })
|
||||
ligne_fixe?: string;
|
||||
|
||||
@Column({ default: true, name: 'actif' })
|
||||
actif: boolean;
|
||||
|
||||
@Column({ type: 'text', name: 'notes', nullable: true })
|
||||
notes?: string;
|
||||
|
||||
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
|
||||
cree_le: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'modifie_le', type: 'timestamptz' })
|
||||
modifie_le: Date;
|
||||
|
||||
@OneToMany(() => Users, user => user.relais)
|
||||
gestionnaires: Users[];
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
Entity, PrimaryGeneratedColumn, Column,
|
||||
CreateDateColumn, UpdateDateColumn,
|
||||
OneToOne, OneToMany
|
||||
OneToOne, OneToMany, ManyToOne, JoinColumn
|
||||
} from 'typeorm';
|
||||
import { AssistanteMaternelle } from './assistantes_maternelles.entity';
|
||||
import { Parents } from './parents.entity';
|
||||
import { Message } from './messages.entity';
|
||||
import { Relais } from './relais.entity';
|
||||
|
||||
// Enums alignés avec la BDD PostgreSQL
|
||||
export enum RoleType {
|
||||
@@ -147,4 +148,11 @@ export class Users {
|
||||
|
||||
@OneToMany(() => Parents, parent => parent.co_parent)
|
||||
co_parent_in?: Parents[];
|
||||
|
||||
@Column({ nullable: true, name: 'relais_id' })
|
||||
relaisId?: string;
|
||||
|
||||
@ManyToOne(() => Relais, relais => relais.gestionnaires, { nullable: true })
|
||||
@JoinColumn({ name: 'relais_id' })
|
||||
relais?: Relais;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user