diff --git a/src/entities/kpiPlan.ts b/src/entities/kpiPlan.ts index efe3672..962c3cc 100644 --- a/src/entities/kpiPlan.ts +++ b/src/entities/kpiPlan.ts @@ -3,15 +3,16 @@ import { EntityBase } from "./base/Base"; import { KpiLink } from "./kpiLink"; import { KpiPeriod } from "./kpiPeriod"; import { KpiUserPlanned } from "./kpiUserPlanned"; +import { KpiPlanHistory } from "./kpiPlanHistory"; @Entity("kpiPlan") export class KpiPlan extends EntityBase { @Column({ nullable: true, - comment: "รหัสตัวชี้วัด", + comment: "ลำดับ/รหัสตัวชี้วัด", default: null, }) - including: string; + including: number; @Column({ nullable: true, @@ -32,7 +33,7 @@ export class KpiPlan extends EntityBase { comment: "หน่วยนับ", default: null, }) - unit: number; + unit: string; @Column({ nullable: true, @@ -285,22 +286,32 @@ export class KpiPlan extends EntityBase { }) kpiPeriodId: string | null; + @Column({ + nullable: true, + comment: "ข้อมูลเอกสารหลักฐาน", + default: null, + }) + documentInfoEvidence: string; + @ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiPlans) @JoinColumn({ name: "kpiPeriodId" }) kpiPeriod: KpiPeriod; @OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiPlan) kpiUserPlanneds: KpiUserPlanned[]; + + @OneToMany(() => KpiPlanHistory, (kpiPlanHistory) => kpiPlanHistory.kpiPlan) + kpiPlanHistories: KpiPlanHistory[]; } export class createKpiPlan { - @Column() - including: string | null; + // @Column() + // including: number | null; @Column() includingName: string | null; @Column() target: string | null; @Column() - unit: number | null; + unit: string | null; @Column() weight: number | null; @Column() @@ -329,17 +340,19 @@ export class createKpiPlan { strategyId: string | null; @Column() kpiPeriodId: string | null; + @Column() + documentInfoEvidence: string | null; } export class updateKpiPlan { - @Column() - including: string | null; + // @Column() + // including: number | null; @Column() includingName: string | null; @Column() target: string | null; @Column() - unit: number | null; + unit: string | null; @Column() weight: number | null; @Column() @@ -368,4 +381,6 @@ export class updateKpiPlan { strategyId: string | null; @Column() kpiPeriodId: string | null; + @Column() + documentInfoEvidence: string | null; } diff --git a/src/entities/kpiPlanHistory.ts b/src/entities/kpiPlanHistory.ts new file mode 100644 index 0000000..e206110 --- /dev/null +++ b/src/entities/kpiPlanHistory.ts @@ -0,0 +1,17 @@ +import { Entity, Column, ManyToOne, JoinColumn, ManyToMany, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { KpiPlan } from "./kpiPlan"; + +@Entity("kpiPlanHistory") +export class KpiPlanHistory extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง kpiPlan", + }) + kpiPlanId: string | null; + + @ManyToOne(() => KpiPlan, (kpiPlan) => kpiPlan.kpiPlanHistories) + @JoinColumn({ name: "kpiPlanId" }) + kpiPlan: KpiPlan; +} diff --git a/src/entities/kpiRole.ts b/src/entities/kpiRole.ts index 7a5a7cb..86fa42e 100644 --- a/src/entities/kpiRole.ts +++ b/src/entities/kpiRole.ts @@ -2,6 +2,7 @@ import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { KpiPeriod } from "./kpiPeriod"; import { KpiUserRole } from "./kpiUserRole"; +import { KpiRoleHistory } from "./kpiRoleHistory"; @Entity("kpiRole") export class KpiRole extends EntityBase { @@ -14,7 +15,7 @@ export class KpiRole extends EntityBase { @Column({ nullable: true, - comment: "รหัสตัวชี้วัด", + comment: "ลำดับ/รหัสตัวชี้วัด", default: null, }) including: string; @@ -38,7 +39,7 @@ export class KpiRole extends EntityBase { comment: "หน่วยนับ", default: null, }) - unit: number; + unit: string; @Column({ nullable: true, @@ -216,24 +217,35 @@ export class KpiRole extends EntityBase { }) kpiPeriodId: string | null; + @Column({ + nullable: true, + comment: "ข้อมูลเอกสารหลักฐาน", + default: null, + }) + documentInfoEvidence: string; + + @ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiRoles) @JoinColumn({ name: "kpiPeriodId" }) kpiPeriod: KpiPeriod; @OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiRole) kpiUserRoles: KpiUserRole[]; + + @OneToMany(() => KpiRoleHistory, (kpiRoleHistory) => kpiRoleHistory.kpiRole) + kpiRoleHistories: KpiRoleHistory[]; } export class createKpiRole { @Column() position: string | null; - @Column() - including: string | null; + // @Column() + // including: string | null; @Column() includingName: string | null; @Column() target: string | null; @Column() - unit: number | null; + unit: string | null; @Column() weight: number | null; @Column() @@ -258,19 +270,21 @@ export class createKpiRole { formula: string | null; @Column() kpiPeriodId: string | null; + @Column() + documentInfoEvidence: string | null; } export class updateKpiRole { @Column() position: string | null; - @Column() - including: string | null; + // @Column() + // including: string | null; @Column() includingName: string | null; @Column() target: string | null; @Column() - unit: number | null; + unit: string | null; @Column() weight: number | null; @Column() @@ -295,4 +309,6 @@ export class updateKpiRole { formula: string | null; @Column() kpiPeriodId: string | null; + @Column() + documentInfoEvidence: string | null; } diff --git a/src/entities/kpiRoleHistory.ts b/src/entities/kpiRoleHistory.ts new file mode 100644 index 0000000..7f515e0 --- /dev/null +++ b/src/entities/kpiRoleHistory.ts @@ -0,0 +1,17 @@ +import { Entity, Column, ManyToOne, JoinColumn, ManyToMany, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { KpiRole } from "./kpiRole"; + +@Entity("kpiRoleHistory") +export class KpiRoleHistory extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง kpiRole", + }) + kpiRoleId: string | null; + + @ManyToOne(() => KpiRole, (kpiRole) => kpiRole.kpiRoleHistories) + @JoinColumn({ name: "kpiRoleId" }) + kpiRole: KpiRole; +}