hrms-api-org/src/entities/ProfileOther.ts

69 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-03-13 10:43:50 +07:00
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
2024-05-13 17:38:21 +07:00
import { ProfileEmployee } from "./ProfileEmployee";
2024-03-13 10:43:50 +07:00
import { ProfileOtherHistory } from "./ProfileOtherHistory";
@Entity("profileOther")
export class ProfileOther extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
2024-05-13 17:38:21 +07:00
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
2024-03-13 10:43:50 +07:00
@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;
2024-05-13 17:38:21 +07:00
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileOthers)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
2024-03-13 10:43:50 +07:00
}
export class CreateProfileOther {
profileId: string | null;
detail: string | null;
date: Date | null;
}
2024-05-13 17:38:21 +07:00
export class CreateProfileEmployeeOther {
profileEmployeeId: string | null;
detail: string | null;
date: Date | null;
}
2024-03-18 17:45:44 +07:00
export type UpdateProfileOther = {
detail?: string | null;
2024-03-18 17:45:44 +07:00
date?: Date | null;
};