add entity org part 1

This commit is contained in:
AdisakKanthawilang 2024-03-12 14:53:15 +07:00
parent 0f7edf5d15
commit f36ff656ef
13 changed files with 1783 additions and 1 deletions

View file

@ -0,0 +1,94 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileCertificate } from "./ProfileCertificate";
@Entity("profileCertificateHistory")
export class ProfileCertificateHistory extends EntityBase {
@Column({
nullable: true,
type: "datetime",
comment: "วันที่หมดอายุ",
default: null,
})
expireDate: Date;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่ออกใบอนุญาต",
default: null,
})
issueDate: Date;
@Column({
nullable: true,
comment: "เลขที่ใบอนุญาต",
length: 20,
default: null,
})
certificateNo: string;
@Column({
nullable: true,
comment: "ชื่อใบอนุญาต",
length: 100,
default: null,
})
certificateType: string;
@Column({
nullable: true,
comment: "หน่วยงานผู้ออกใบอนุญาต",
length: 200,
default: null,
})
issuer: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileCertificate",
default: null,
})
profileCertificateId: string;
@ManyToOne(() => ProfileCertificate, (profileCertificate) => profileCertificate.profileCertificateHistories)
@JoinColumn({ name: "profileCertificateId" })
histories: ProfileCertificate;
}
export class CreateProfileCertificateHistory {
@Column()
expireDate: Date | null;
@Column()
isActive: boolean;
@Column()
issueDate: Date | null;
@Column()
certificateNo: string | null;
@Column()
certificateType: string | null;
@Column()
issuer: string | null;
@Column("uuid")
profileCertificateId: string | null;
}
export type UpdateProfileCertificateHistory = Partial<CreateProfileCertificateHistory>;