no message

This commit is contained in:
Kittapath 2024-04-22 16:30:24 +07:00
parent 65e1d682b1
commit 42264be4a2
16 changed files with 55 additions and 201 deletions

View file

@ -2,11 +2,7 @@ import { Entity, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacityDetail } from "./kpiCapacityDetail";
import { KpiLink } from "./kpiLink";
import { KpiUserInspector } from "./kpiUserInspector";
import { KpiUserDirector } from "./kpiUserDirector";
import { KpiUserExecutive } from "./kpiUserExecutive";
import { KpiUserGroup } from "./kpiUserGroup";
import { KpiUserHead } from "./kpiUserHead";
import { KpiUserCapacity } from "./kpiUserCapacity";
enum CapacityType {
HEAD = "HEAD",
@ -44,36 +40,15 @@ export class KpiCapacity extends EntityBase {
})
description: string;
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacitys)
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacity)
kpiCapacityDetails: KpiCapacityDetail[];
@ManyToMany(() => KpiLink, (kpiLink) => kpiLink.kpiCapacitys)
@JoinTable()
kpiLinks: KpiLink[];
// @OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiCapacitys)
// kpiUserPlanneds: KpiUserPlanned[];
// @OneToMany(() => KpiUserPosition, (kpiUserPosition) => kpiUserPosition.kpiCapacitys)
// kpiUserPositions: KpiUserPosition[];
// @OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiCapacitys)
// kpiUserSpecials: KpiUserSpecial[];
@OneToMany(() => KpiUserHead, (kpiUserHead) => kpiUserHead.kpiCapacitys)
kpiUserHeads: KpiUserHead[];
@OneToMany(() => KpiUserGroup, (kpiUserGroup) => kpiUserGroup.kpiCapacitys)
kpiUserGroups: KpiUserGroup[];
@OneToMany(() => KpiUserExecutive, (kpiUserExecutive) => kpiUserExecutive.kpiCapacitys)
kpiUserExecutives: KpiUserExecutive[];
@OneToMany(() => KpiUserDirector, (kpiUserDirector) => kpiUserDirector.kpiCapacitys)
kpiUserDirectors: KpiUserDirector[];
@OneToMany(() => KpiUserInspector, (kpiUserInspector) => kpiUserInspector.kpiCapacitys)
kpiUserInspectors: KpiUserInspector[];
@OneToMany(() => KpiUserCapacity, (kpiUserCapacity) => kpiUserCapacity.kpiCapacity)
kpiUserCapacitys: KpiUserCapacity[];
}
export class createKpiCapacity {
@Column()

View file

@ -1,7 +1,6 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserHead } from "./kpiUserHead";
@Entity("kpiCapacityDetail")
export class KpiCapacityDetail extends EntityBase {
@ -30,7 +29,7 @@ export class KpiCapacityDetail extends EntityBase {
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiCapacityDetails)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
kpiCapacity: KpiCapacity;
}
export class createKpiCapacityDetail {
@Column()

View file

@ -52,7 +52,7 @@ export class KpiPeriod extends EntityBase {
kpiSpecials: KpiSpecial[];
@OneToMany(() => KpiUserEvaluation, (kpiPlan) => kpiPlan.kpiPeriod)
kpiUserEvaluation: KpiUserEvaluation[];
kpiUserEvaluations: KpiUserEvaluation[];
}
export class createKpiPeriod {
@Column()

View file

@ -289,7 +289,7 @@ export class KpiPlan extends EntityBase {
@JoinColumn({ name: "kpiPeriodId" })
kpiPeriod: KpiPeriod;
@OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiPlans)
@OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiPlan)
kpiUserPlanneds: KpiUserPlanned[];
}
export class createKpiPlan {

View file

@ -220,7 +220,7 @@ export class KpiRole extends EntityBase {
@JoinColumn({ name: "kpiPeriodId" })
kpiPeriod: KpiPeriod;
@OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiRoles)
@OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiRole)
kpiUserRoles: KpiUserRole[];
}
export class createKpiRole {

View file

@ -289,7 +289,7 @@ export class KpiSpecial extends EntityBase {
@JoinColumn({ name: "kpiPeriodId" })
kpiPeriod: KpiPeriod;
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiSpecials)
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiSpecial)
kpiUserSpecials: KpiUserSpecial[];
}
export class createKpiSpecial {

View file

@ -3,8 +3,8 @@ import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserGroup")
export class KpiUserGroup extends EntityBase {
@Entity("kpiUserCapacity")
export class KpiUserCapacity extends EntityBase {
@Column({
nullable: true,
length: 40,
@ -13,9 +13,9 @@ export class KpiUserGroup extends EntityBase {
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserGroups)
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserCapacitys)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
kpiUserEvaluation: KpiUserEvaluation;
@Column({
nullable: true,
@ -25,7 +25,7 @@ export class KpiUserGroup extends EntityBase {
})
kpiCapacityId: string;
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserGroups)
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserCapacitys)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
kpiCapacity: KpiCapacity;
}

View file

@ -1,31 +0,0 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserDirector")
export class KpiUserDirector extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserDirectors)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiCapacity",
default: null,
})
kpiCapacityId: string;
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserDirectors)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
}

View file

@ -1,14 +1,10 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiPeriod } from "./kpiPeriod";
import { KpiUserHead } from "./kpiUserHead";
import { KpiUserGroup } from "./kpiUserGroup";
import { KpiUserExecutive } from "./kpiUserExecutive";
import { KpiUserDirector } from "./kpiUserDirector";
import { KpiUserInspector } from "./kpiUserInspector";
import { KpiUserSpecial } from "./kpiUserSpecial";
import { KpiUserRole } from "./kpiUserRole";
import { KpiUserPlanned } from "./kpiUserPlanned";
import { KpiUserCapacity } from "./kpiUserCapacity";
@Entity("kpiUserEvaluation")
export class KpiUserEvaluation extends EntityBase {
@Column({
@ -51,48 +47,38 @@ export class KpiUserEvaluation extends EntityBase {
})
profileId: string;
@Column({ // PENDING = รอการประเมิน , INPROGRESS = กําลังประเมิน , DONE = ประเมินเสร็จสิ้น
nullable: true,
@Column({
// PENDING = รอการประเมิน , INPROGRESS = กําลังประเมิน , DONE = ประเมินเสร็จสิ้น
nullable: true,
length: 40,
comment: "สถานะการประเมินผล",
comment: "สถานะการประเมินผล",
default: null,
})
evaluationStatus: string;
@Column({ // PASSED = ผ่านการประเมิน , NOTPASSED = ไม่ผ่านการประเมิน
nullable: true,
@Column({
// PASSED = ผ่านการประเมิน , NOTPASSED = ไม่ผ่านการประเมิน
nullable: true,
length: 40,
comment: "ผลการประเมิน",
comment: "ผลการประเมิน",
default: null,
})
evaluationResults: string;
@ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiUserEvaluation)
@ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiUserEvaluations)
@JoinColumn({ name: "kpiPeriodId" })
kpiPeriod: KpiPeriod;
@OneToMany(() => KpiUserHead, (kpiUserHead) => kpiUserHead.kpiUserEvaluations)
kpiUserHeads: KpiUserHead[];
@OneToMany(() => KpiUserCapacity, (kpiUserCapacity) => kpiUserCapacity.kpiUserEvaluation)
kpiUserCapacitys: KpiUserCapacity[];
@OneToMany(() => KpiUserGroup, (kpiUserGroup) => kpiUserGroup.kpiUserEvaluations)
kpiUserGroups: KpiUserGroup[];
@OneToMany(() => KpiUserExecutive, (kpiUserExecutive) => kpiUserExecutive.kpiUserEvaluations)
kpiUserExecutives: KpiUserExecutive[];
@OneToMany(() => KpiUserDirector, (kpiUserDirector) => kpiUserDirector.kpiUserEvaluations)
kpiUserDirectors: KpiUserDirector[];
@OneToMany(() => KpiUserInspector, (kpiUserInspector) => kpiUserInspector.kpiUserEvaluations)
kpiUserInspectors: KpiUserInspector[];
@OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiUserEvaluations)
@OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiUserEvaluation)
kpiUserPlanneds: KpiUserPlanned[];
@OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiUserEvaluations)
@OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiUserEvaluation)
kpiUserRoles: KpiUserRole[];
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiUserEvaluations)
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiUserEvaluation)
kpiUserSpecials: KpiUserSpecial[];
}

View file

@ -1,31 +0,0 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserExecutive")
export class KpiUserExecutive extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserExecutives)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiCapacity",
default: null,
})
kpiCapacityId: string;
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserExecutives)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
}

View file

@ -1,31 +0,0 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserHead")
export class KpiUserHead extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserHeads)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiCapacity",
default: null,
})
kpiCapacityId: string;
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserHeads)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
}

View file

@ -1,31 +0,0 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacity } from "./kpiCapacity";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
@Entity("kpiUserInspector")
export class KpiUserInspector extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserInspectors)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiCapacity",
default: null,
})
kpiCapacityId: string;
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserInspectors)
@JoinColumn({ name: "kpiCapacityId" })
kpiCapacitys: KpiCapacity;
}

View file

@ -50,7 +50,7 @@ export class KpiUserPlanned extends EntityBase {
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserPlanneds)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
kpiUserEvaluation: KpiUserEvaluation;
@Column({
nullable: true,
@ -62,5 +62,5 @@ export class KpiUserPlanned extends EntityBase {
@ManyToOne(() => KpiPlan, (kpiPlan) => kpiPlan.kpiUserPlanneds)
@JoinColumn({ name: "kpiPlanId" })
kpiPlans: KpiPlan;
kpiPlan: KpiPlan;
}

View file

@ -50,7 +50,7 @@ export class KpiUserRole extends EntityBase {
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserRoles)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
kpiUserEvaluation: KpiUserEvaluation;
@Column({
nullable: true,
@ -62,5 +62,5 @@ export class KpiUserRole extends EntityBase {
@ManyToOne(() => KpiRole, (kpiRole) => kpiRole.kpiUserRoles)
@JoinColumn({ name: "kpiRoleId" })
kpiRoles: KpiRole;
kpiRole: KpiRole;
}

View file

@ -50,7 +50,7 @@ export class KpiUserSpecial extends EntityBase {
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserSpecials)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluations: KpiUserEvaluation;
kpiUserEvaluation: KpiUserEvaluation;
@Column({
nullable: true,
@ -62,5 +62,5 @@ export class KpiUserSpecial extends EntityBase {
@ManyToOne(() => KpiSpecial, (kpiSpecial) => kpiSpecial.kpiUserSpecials)
@JoinColumn({ name: "kpiSpecialId" })
kpiSpecials: KpiSpecial;
kpiSpecial: KpiSpecial;
}

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableKpiUserSpecial11713778172793 implements MigrationInterface {
name = 'AddTableKpiUserSpecial11713778172793'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`kpiUserCapacity\` (\`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', \`kpiUserEvaluationId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiUserEvaluation', \`kpiCapacityId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiCapacity', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` ADD CONSTRAINT \`FK_1aef260bab99de5f8278082da55\` FOREIGN KEY (\`kpiUserEvaluationId\`) REFERENCES \`kpiUserEvaluation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` ADD CONSTRAINT \`FK_d0bfc0e85bc171bcc631c621266\` FOREIGN KEY (\`kpiCapacityId\`) REFERENCES \`kpiCapacity\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` DROP FOREIGN KEY \`FK_d0bfc0e85bc171bcc631c621266\``);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` DROP FOREIGN KEY \`FK_1aef260bab99de5f8278082da55\``);
await queryRunner.query(`DROP TABLE \`kpiUserCapacity\``);
}
}