From 6acd24e98ab2c3bdf0b025a10284763bab72ba88 Mon Sep 17 00:00:00 2001 From: "DESKTOP-2S5P7D1\\Windows 10" Date: Tue, 5 Nov 2024 13:20:03 +0700 Subject: [PATCH] add posno --- src/entities/Appoint.ts | 98 +++++++++++++++--------------- src/entities/AppointDirector.ts | 104 ++++++++++++++++++-------------- 2 files changed, 108 insertions(+), 94 deletions(-) diff --git a/src/entities/Appoint.ts b/src/entities/Appoint.ts index fdd27f0..9295ea2 100644 --- a/src/entities/Appoint.ts +++ b/src/entities/Appoint.ts @@ -1,66 +1,68 @@ -import { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn, OneToOne } from "typeorm"; -import { EntityBase } from "./base/Base"; -import { AppointDirector } from "./AppointDirector"; -import { Personal } from "./Personal"; +import { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn, OneToOne } from "typeorm" +import { EntityBase } from "./base/Base" +import { AppointDirector } from "./AppointDirector" +import { Personal } from "./Personal" @Entity("appoint") export class Appoint extends EntityBase { - @PrimaryGeneratedColumn("uuid") - id: string; + @PrimaryGeneratedColumn("uuid") + id: string - @Column({ - nullable: false, - comment: "id ของคนทดลองงาน", - }) - profileId: string; + @Column({ + nullable: false, + comment: "id ของคนทดลองงาน", + }) + profileId: string - @Column({ - nullable: false, - comment: "หัวข้อ", - default: 0, - }) - topic: string; + @Column({ + nullable: false, + comment: "หัวข้อ", + default: 0, + }) + topic: string - @Column({ - nullable: true, - comment: "เลขที่คำสั่ง", - }) - commandNo: string; + @Column({ + nullable: true, + comment: "เลขที่คำสั่ง", + }) + commandNo: string - @Column({ - type: "enum", - enum: ["PENDING", "REPORT", "DONE"], - nullable: false, - default: "PENDING", - }) - status: string; + @Column({ + type: "enum", + enum: ["PENDING", "REPORT", "DONE"], + nullable: false, + default: "PENDING", + }) + status: string - @OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint) - @JoinColumn({ name: "id" }) - directors: AppointDirector[]; + @OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint) + @JoinColumn({ name: "id" }) + directors: AppointDirector[] - @OneToOne(() => Personal, (personal: Personal) => personal.personal_id) - @JoinColumn({ name: "profileId" }) - personal: Personal; + @OneToOne(() => Personal, (personal: Personal) => personal.personal_id) + @JoinColumn({ name: "profileId" }) + personal: Personal } export class CreateAppoint { - @Column() - topic: string; - profileId: string; + @Column() + topic: string + profileId: string } export type Person = { - profileId: string; - name: string; - position: string; - positionType: string; - positionLevel: string; - role: string; -}; + profileId: string + name: string + position: string + positionType: string + positionLevel: string + role: string + posNo: string + actFullName: string +} export class UpdateAppoint { - @Column() - topic: string; - persons: Person[]; + @Column() + topic: string + persons: Person[] } diff --git a/src/entities/AppointDirector.ts b/src/entities/AppointDirector.ts index 226b965..5d7b8c0 100644 --- a/src/entities/AppointDirector.ts +++ b/src/entities/AppointDirector.ts @@ -1,58 +1,70 @@ -import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from "typeorm"; -import { EntityBase } from "./base/Base"; -import { Appoint } from "./Appoint"; +import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from "typeorm" +import { EntityBase } from "./base/Base" +import { Appoint } from "./Appoint" @Entity("appointDirector") export class AppointDirector extends EntityBase { - @PrimaryGeneratedColumn("uuid") - id: string; + @PrimaryGeneratedColumn("uuid") + id: string - @Column({ - nullable: false, - comment: "id ของการแต่งตั้งกรรมการ", - }) - appointId: string; + @Column({ + nullable: false, + comment: "id ของการแต่งตั้งกรรมการ", + }) + appointId: string - @Column({ - nullable: false, - comment: "id ของคน", - }) - profileId: string; + @Column({ + nullable: false, + comment: "id ของคน", + }) + profileId: string - @Column({ - nullable: false, - comment: "ชื่อ-นามสกุลของประธาน/กรรมการ", - }) - name: string; + @Column({ + nullable: false, + comment: "ชื่อ-นามสกุลของประธาน/กรรมการ", + }) + name: string - @Column({ - nullable: true, - comment: "ตำแหน่ง", - }) - position: string; + @Column({ + nullable: true, + comment: "ตำแหน่ง", + }) + position: string - @Column({ - nullable: true, - comment: "ประเภทตำแหน่ง", - }) - positionType: string; + @Column({ + nullable: true, + comment: "ประเภทตำแหน่ง", + }) + positionType: string - @Column({ - nullable: true, - comment: "ระดับตำแหน่ง", - }) - positionLevel: string; + @Column({ + nullable: true, + comment: "ระดับตำแหน่ง", + }) + positionLevel: string - @Column({ - type: "enum", - enum: ["chairman", "committee", "caregiver"], - nullable: false, - default: "committee", - comment: "บทบาท ประธาน/กรรมการ/ผู้ดูแล", - }) - role: string; + @Column({ + type: "enum", + enum: ["chairman", "committee", "caregiver"], + nullable: false, + default: "committee", + comment: "บทบาท ประธาน/กรรมการ/ผู้ดูแล", + }) + role: string - @ManyToOne(() => Appoint, (appoint: Appoint) => appoint.directors) - @JoinColumn({ name: "appointId" }) - appoint: Appoint; + @Column({ + nullable: true, + comment: "เลขที่ตำแหน่ง", + }) + posNo: string + + @Column({ + nullable: true, + comment: "รักษาการแทน", + }) + actFullName: string + + @ManyToOne(() => Appoint, (appoint: Appoint) => appoint.directors) + @JoinColumn({ name: "appointId" }) + appoint: Appoint }