fix: insignia relations

This commit is contained in:
Methapon2001 2024-03-18 18:03:01 +07:00
parent 8339c55472
commit b0292f3921
4 changed files with 74 additions and 186 deletions

View file

@ -1,7 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileInsignia } from "./ProfileInsignia";
import { Insignia } from "./Insignia";
@Entity("profileInsigniaHistory")
export class ProfileInsigniaHistory extends EntityBase {
@ -11,112 +11,46 @@ export class ProfileInsigniaHistory extends EntityBase {
})
isActive: boolean;
@Column({
comment: "ปีที่ยื่นขอ",
})
@Column({ comment: "ปีที่ยื่นขอ" })
year: number;
@Column({
nullable: true,
length: 20,
comment: "ลำดับที่",
default: null,
})
@Column({ nullable: true, length: 20, comment: "ลำดับที่", default: null })
no: string;
@Column({
nullable: true,
length: 30,
comment: "เล่ม",
default: null,
})
@Column({ nullable: true, length: 30, comment: "เล่ม", default: null })
volume: string;
@Column({
nullable: true,
length: 30,
comment: "ตอน",
default: null,
})
@Column({ nullable: true, length: 30, comment: "ตอน", default: null })
section: string;
@Column({
nullable: true,
length: 30,
comment: "หน้า",
default: null,
})
@Column({ nullable: true, length: 30, comment: "หน้า", default: null })
page: string;
@Column({
nullable: true,
type: "datetime",
comment: "ลงวันที่",
default: null,
})
@Column({ nullable: true, type: "datetime", comment: "ลงวันที่", default: null })
receiveDate: Date;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Insignia",
default: null,
})
@Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง Insignia", default: null })
insigniaId: string;
@Column({
nullable: true,
comment: "ประเภท",
type: "text",
default: null,
})
insigniaType: string;
@ManyToOne(() => Insignia, (v) => v.profileInsigniaHistories)
insignia: Insignia;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่ประกาศในราชกิจจาฯ",
default: null,
})
@Column({ nullable: true, type: "datetime", comment: "วันที่ประกาศในราชกิจจาฯ", default: null })
dateAnnounce: Date;
@Column({
nullable: true,
length: 300,
comment: "ราชกิจจาฯ ฉบับที่",
default: null,
})
@Column({ nullable: true, length: 300, comment: "ราชกิจจาฯ ฉบับที่", default: null })
issue: string;
@Column({
nullable: true,
length: 30,
comment: "เล่มที่",
default: null,
})
@Column({ nullable: true, length: 30, comment: "เล่มที่", default: null })
volumeNo: string;
@Column({
nullable: true,
type: "datetime",
comment: "เอกสารอ้างอิง (ลงวันที่)",
default: null,
})
@Column({ nullable: true, type: "datetime", comment: "เอกสารอ้างอิง (ลงวันที่)", default: null })
refCommandDate: Date;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
type: "text",
default: null,
})
@Column({ nullable: true, comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", type: "text", default: null })
refCommandNo: string;
@Column({
nullable: true,
comment: "หมายเหตุ",
default: null,
})
@Column({ nullable: true, comment: "หมายเหตุ", default: null })
note: string;
@Column({
@ -131,55 +65,3 @@ export class ProfileInsigniaHistory extends EntityBase {
@JoinColumn({ name: "profileInsigniaId" })
histories: ProfileInsignia;
}
export class CreateProfileInsigniaHistory {
@Column()
isActive: boolean;
@Column()
year: number;
@Column()
no: string | null;
@Column()
volume: string | null;
@Column()
section: string | null;
@Column()
page: string | null;
@Column()
receiveDate: Date | null;
@Column("uuid")
insigniaId: string | null;
@Column()
insigniaType: string | null;
@Column()
dateAnnounce: Date | null;
@Column()
issue: string | null;
@Column()
volumeNo: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column()
note: string | null;
@Column("uuid")
profileInsigniaId: string | null;
}
export type UpdateProfileInsigniaHistory = Partial<CreateProfileInsigniaHistory>;