add posno

This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2024-11-05 13:20:03 +07:00
parent ff2edc685c
commit 6acd24e98a
2 changed files with 108 additions and 94 deletions

View file

@ -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[]
}

View file

@ -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
}