hrms-api-kpi/src/entities/kpiPeriod.ts
2024-04-23 15:52:37 +07:00

73 lines
1.5 KiB
TypeScript

import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiPlan } from "./kpiPlan";
import { KpiRole } from "./kpiRole";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiPeriod")
export class KpiPeriod extends EntityBase {
@Column({
nullable: true,
comment: "ปีงบประมาณ",
})
year: number;
@Column({
nullable: true,
comment: "รอบการประเมิน",
default: null,
})
durationKPI: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันเริ่มต้น",
default: null,
})
startDate: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันสิ้นสุด",
default: null,
})
endDate: Date;
@Column({
comment: "รอบ",
default: true,
})
isActive: boolean;
@OneToMany(() => KpiRole, (kpiRole) => kpiRole.kpiPeriod)
kpiRoles: KpiRole[];
@OneToMany(() => KpiPlan, (kpiPlan) => kpiPlan.kpiPeriod)
kpiPlans: KpiPlan[];
@OneToMany(() => KpiUserEvaluation, (kpiPlan) => kpiPlan.kpiPeriod)
kpiUserEvaluations: KpiUserEvaluation[];
}
export class createKpiPeriod {
@Column()
year: number;
@Column()
durationKPI: string;
@Column()
startDate: Date;
@Column()
endDate: Date;
}
export class updateKpiPeriod {
@Column()
year: number;
@Column()
durationKPI: string;
@Column()
startDate: Date;
@Column()
endDate: Date;
}