Merge branch 'develop' into adiDev
This commit is contained in:
commit
fcbe8e99ef
6 changed files with 500 additions and 0 deletions
72
src/entities/Insignia.ts
Normal file
72
src/entities/Insignia.ts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { InsigniaType } from "./InsigniaType";
|
||||
|
||||
@Entity("insignia")
|
||||
export class Insignia extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อเครื่องราช",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อเครื่องราช",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
shortName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment:
|
||||
"ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น",
|
||||
default: null,
|
||||
})
|
||||
level: number;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หมายเหตุ",
|
||||
default: null,
|
||||
})
|
||||
note: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "id ประเภทเครื่องราช",
|
||||
})
|
||||
insigniaTypeId: string;
|
||||
|
||||
@ManyToOne(() => InsigniaType, (insigniaType) => insigniaType.insignias)
|
||||
@JoinColumn({ name: "insigniaTypeId" })
|
||||
insigniaType: InsigniaType;
|
||||
}
|
||||
|
||||
export class CreateInsignias {
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@Column()
|
||||
shortName: string;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
|
||||
@Column()
|
||||
note: string;
|
||||
|
||||
@Column("uuid")
|
||||
insigniaTypeId: string;
|
||||
}
|
||||
|
||||
export type UpdateInsignias = Partial<CreateInsignias>;
|
||||
33
src/entities/InsigniaType.ts
Normal file
33
src/entities/InsigniaType.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Insignia } from "./Insignia";
|
||||
|
||||
@Entity("insigniaType")
|
||||
export class InsigniaType extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อประเภทเครื่องราช",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@OneToMany(() => Insignia, (insignia) => insignia.insigniaType)
|
||||
insignias: Insignia[];
|
||||
}
|
||||
|
||||
export class CreateInsigniaType {
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export type UpdateInsigniaType = Partial<CreateInsigniaType>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue