edit entity

This commit is contained in:
AdisakKanthawilang 2024-05-03 16:44:44 +07:00
parent 3ce3bed13a
commit 94039ac694
4 changed files with 82 additions and 17 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}