This commit is contained in:
Kittapath 2024-05-08 13:31:43 +07:00
parent f22cddbeee
commit 2d126a76d2
5 changed files with 183 additions and 1 deletions

View file

@ -4,6 +4,20 @@ import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiSpecial")
export class KpiSpecial extends EntityBase {
@Column({
nullable: true,
comment: "รอบ",
default: null,
})
period: string;
@Column({
nullable: true,
comment: "ปี",
default: null,
})
year: string;
@Column({
nullable: true,
comment: "รหัสตัวชี้วัด",

View file

@ -0,0 +1,124 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserDevelopment")
export class KpiUserDevelopment extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อเรื่อง",
default: null,
})
name: string;
@Column({
nullable: true,
comment: "เป้าหมาย",
default: null,
})
target: string;
@Column({
type: "double",
nullable: true,
default: null,
comment: "ผลการประเมิน",
})
summary: number;
@Column({
nullable: true,
comment: "เกณฑ์การประเมิน 10",
default: null,
})
achievement10: string;
@Column({
nullable: true,
comment: "เกณฑ์การประเมิน 5",
default: null,
})
achievement5: string;
@Column({
nullable: true,
comment: "เกณฑ์การประเมิน 0",
default: null,
})
achievement0: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserDevelopments)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluation: KpiUserEvaluation;
}
export class CreateKpiUserSpecial {
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
}
export class UpdateKpiUserSpecial {
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
}
export class KpiUserSpecialDataPoint {
id: string;
point: number;
}

View file

@ -6,6 +6,7 @@ import { KpiUserRole } from "./kpiUserRole";
import { KpiUserPlanned } from "./kpiUserPlanned";
import { KpiUserCapacity } from "./kpiUserCapacity";
import { KpiUserEvaluationReason } from "./kpiUserEvaluationReason";
import { KpiUserDevelopment } from "./kpiUserDevelopment";
@Entity("kpiUserEvaluation")
export class KpiUserEvaluation extends EntityBase {
@Column({
@ -69,7 +70,7 @@ export class KpiUserEvaluation extends EntityBase {
nullable: true,
length: 40,
comment:
"สถานะการประเมินผล ดังนี้ PENDING = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น",
"สถานะการประเมินผล ดังนี้ NEW = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น",
default: null,
})
evaluationStatus: string;
@ -140,6 +141,9 @@ export class KpiUserEvaluation extends EntityBase {
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiUserEvaluation)
kpiUserSpecials: KpiUserSpecial[];
@OneToMany(() => KpiUserDevelopment, (kpiUserDevelopment) => kpiUserDevelopment.kpiUserEvaluation)
kpiUserDevelopments: KpiUserDevelopment[];
@OneToMany(
() => KpiUserEvaluationReason,
(kpiUserEvaluationReason) => kpiUserEvaluationReason.kpiUserEvaluation,

View file

@ -4,6 +4,20 @@ import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserSpecial")
export class KpiUserSpecial extends EntityBase {
@Column({
nullable: true,
comment: "รอบ",
default: null,
})
period: string;
@Column({
nullable: true,
comment: "ปี",
default: null,
})
year: string;
@Column({
nullable: true,
comment: "รหัสตัวชี้วัด",

View file

@ -0,0 +1,26 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableKpiDevelopment1715147757259 implements MigrationInterface {
name = 'AddTableKpiDevelopment1715147757259'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`kpiUserDevelopment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'ชื่อเรื่อง', \`target\` varchar(255) NULL COMMENT 'เป้าหมาย', \`summary\` double NULL COMMENT 'ผลการประเมิน', \`achievement10\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 10', \`achievement5\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 5', \`achievement0\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 0', \`kpiUserEvaluationId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiUserEvaluation', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`kpiUserSpecial\` ADD \`period\` varchar(255) NULL COMMENT 'รอบ'`);
await queryRunner.query(`ALTER TABLE \`kpiUserSpecial\` ADD \`year\` varchar(255) NULL COMMENT 'ปี'`);
await queryRunner.query(`ALTER TABLE \`kpiSpecial\` ADD \`period\` varchar(255) NULL COMMENT 'รอบ'`);
await queryRunner.query(`ALTER TABLE \`kpiSpecial\` ADD \`year\` varchar(255) NULL COMMENT 'ปี'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`evaluationStatus\` \`evaluationStatus\` varchar(40) NULL COMMENT 'สถานะการประเมินผล ดังนี้ NEW = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น'`);
await queryRunner.query(`ALTER TABLE \`kpiUserDevelopment\` ADD CONSTRAINT \`FK_d7b8acb8bfc3c3b6fe7a769c70d\` FOREIGN KEY (\`kpiUserEvaluationId\`) REFERENCES \`kpiUserEvaluation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserDevelopment\` DROP FOREIGN KEY \`FK_d7b8acb8bfc3c3b6fe7a769c70d\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`evaluationStatus\` \`evaluationStatus\` varchar(40) NULL COMMENT 'สถานะการประเมินผล ดังนี้ PENDING = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น'`);
await queryRunner.query(`ALTER TABLE \`kpiSpecial\` DROP COLUMN \`year\``);
await queryRunner.query(`ALTER TABLE \`kpiSpecial\` DROP COLUMN \`period\``);
await queryRunner.query(`ALTER TABLE \`kpiUserSpecial\` DROP COLUMN \`year\``);
await queryRunner.query(`ALTER TABLE \`kpiUserSpecial\` DROP COLUMN \`period\``);
await queryRunner.query(`DROP TABLE \`kpiUserDevelopment\``);
}
}