58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
import { ProfileOtherHistory } from "./ProfileOtherHistory";
|
|
|
|
@Entity("profileOther")
|
|
export class ProfileOther extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@Column({
|
|
comment: "สถานะการใช้งาน",
|
|
default: false,
|
|
})
|
|
isActive: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "รายละเอียด",
|
|
type: "text",
|
|
default: null,
|
|
})
|
|
detail: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "วันที่",
|
|
default: null,
|
|
})
|
|
date: Date;
|
|
|
|
@OneToMany(() => ProfileOtherHistory, (profileOtherHistory) => profileOtherHistory.histories)
|
|
profileOtherHistories: ProfileOtherHistory[];
|
|
|
|
@ManyToOne(() => Profile, (profile) => profile.profileOthers)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
}
|
|
|
|
export class CreateProfileOther {
|
|
profileId: string | null;
|
|
isActive: boolean;
|
|
detail: string | null;
|
|
date: Date | null;
|
|
}
|
|
|
|
export type UpdateProfileOther = {
|
|
profileId: string | null;
|
|
isActive: boolean;
|
|
detail: string | null;
|
|
date?: Date | null;
|
|
};
|