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 { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn, OneToOne } from "typeorm"
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base"
import { AppointDirector } from "./AppointDirector"; import { AppointDirector } from "./AppointDirector"
import { Personal } from "./Personal"; import { Personal } from "./Personal"
@Entity("appoint") @Entity("appoint")
export class Appoint extends EntityBase { export class Appoint extends EntityBase {
@PrimaryGeneratedColumn("uuid") @PrimaryGeneratedColumn("uuid")
id: string; id: string
@Column({ @Column({
nullable: false, nullable: false,
comment: "id ของคนทดลองงาน", comment: "id ของคนทดลองงาน",
}) })
profileId: string; profileId: string
@Column({ @Column({
nullable: false, nullable: false,
comment: "หัวข้อ", comment: "หัวข้อ",
default: 0, default: 0,
}) })
topic: string; topic: string
@Column({ @Column({
nullable: true, nullable: true,
comment: "เลขที่คำสั่ง", comment: "เลขที่คำสั่ง",
}) })
commandNo: string; commandNo: string
@Column({ @Column({
type: "enum", type: "enum",
enum: ["PENDING", "REPORT", "DONE"], enum: ["PENDING", "REPORT", "DONE"],
nullable: false, nullable: false,
default: "PENDING", default: "PENDING",
}) })
status: string; status: string
@OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint) @OneToMany(() => AppointDirector, (director: AppointDirector) => director.appoint)
@JoinColumn({ name: "id" }) @JoinColumn({ name: "id" })
directors: AppointDirector[]; directors: AppointDirector[]
@OneToOne(() => Personal, (personal: Personal) => personal.personal_id) @OneToOne(() => Personal, (personal: Personal) => personal.personal_id)
@JoinColumn({ name: "profileId" }) @JoinColumn({ name: "profileId" })
personal: Personal; personal: Personal
} }
export class CreateAppoint { export class CreateAppoint {
@Column() @Column()
topic: string; topic: string
profileId: string; profileId: string
} }
export type Person = { export type Person = {
profileId: string; profileId: string
name: string; name: string
position: string; position: string
positionType: string; positionType: string
positionLevel: string; positionLevel: string
role: string; role: string
}; posNo: string
actFullName: string
}
export class UpdateAppoint { export class UpdateAppoint {
@Column() @Column()
topic: string; topic: string
persons: Person[]; persons: Person[]
} }

View file

@ -1,58 +1,70 @@
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from "typeorm"
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base"
import { Appoint } from "./Appoint"; import { Appoint } from "./Appoint"
@Entity("appointDirector") @Entity("appointDirector")
export class AppointDirector extends EntityBase { export class AppointDirector extends EntityBase {
@PrimaryGeneratedColumn("uuid") @PrimaryGeneratedColumn("uuid")
id: string; id: string
@Column({ @Column({
nullable: false, nullable: false,
comment: "id ของการแต่งตั้งกรรมการ", comment: "id ของการแต่งตั้งกรรมการ",
}) })
appointId: string; appointId: string
@Column({ @Column({
nullable: false, nullable: false,
comment: "id ของคน", comment: "id ของคน",
}) })
profileId: string; profileId: string
@Column({ @Column({
nullable: false, nullable: false,
comment: "ชื่อ-นามสกุลของประธาน/กรรมการ", comment: "ชื่อ-นามสกุลของประธาน/กรรมการ",
}) })
name: string; name: string
@Column({ @Column({
nullable: true, nullable: true,
comment: "ตำแหน่ง", comment: "ตำแหน่ง",
}) })
position: string; position: string
@Column({ @Column({
nullable: true, nullable: true,
comment: "ประเภทตำแหน่ง", comment: "ประเภทตำแหน่ง",
}) })
positionType: string; positionType: string
@Column({ @Column({
nullable: true, nullable: true,
comment: "ระดับตำแหน่ง", comment: "ระดับตำแหน่ง",
}) })
positionLevel: string; positionLevel: string
@Column({ @Column({
type: "enum", type: "enum",
enum: ["chairman", "committee", "caregiver"], enum: ["chairman", "committee", "caregiver"],
nullable: false, nullable: false,
default: "committee", default: "committee",
comment: "บทบาท ประธาน/กรรมการ/ผู้ดูแล", comment: "บทบาท ประธาน/กรรมการ/ผู้ดูแล",
}) })
role: string; role: string
@ManyToOne(() => Appoint, (appoint: Appoint) => appoint.directors) @Column({
@JoinColumn({ name: "appointId" }) nullable: true,
appoint: Appoint; comment: "เลขที่ตำแหน่ง",
})
posNo: string
@Column({
nullable: true,
comment: "รักษาการแทน",
})
actFullName: string
@ManyToOne(() => Appoint, (appoint: Appoint) => appoint.directors)
@JoinColumn({ name: "appointId" })
appoint: Appoint
} }