From 29f95d3ae22739a525df27dda529d8860bd562a6 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Sat, 16 Mar 2024 12:05:45 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=E0=B8=A5=E0=B8=B9=E0=B8=81?= =?UTF-8?q?=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrganizationUnauthorizeController.ts | 199 ++++++++ src/controllers/ProfileEmployeeController.ts | 41 +- src/entities/ProfileDisciplineEmployee.ts | 106 +++++ .../ProfileDisciplineEmployeeHistory.ts | 74 +++ src/entities/ProfileEmployee.ts | 10 +- src/entities/ProfileSalaryEmployee.ts | 447 ++++++++++++++++++ src/entities/ProfileSalaryEmployeeHistory.ts | 440 +++++++++++++++++ ...5430715-add_table_profilesalaryemployee.ts | 28 ++ 8 files changed, 1317 insertions(+), 28 deletions(-) create mode 100644 src/entities/ProfileDisciplineEmployee.ts create mode 100644 src/entities/ProfileDisciplineEmployeeHistory.ts create mode 100644 src/entities/ProfileSalaryEmployee.ts create mode 100644 src/entities/ProfileSalaryEmployeeHistory.ts create mode 100644 src/migration/1710565430715-add_table_profilesalaryemployee.ts diff --git a/src/controllers/OrganizationUnauthorizeController.ts b/src/controllers/OrganizationUnauthorizeController.ts index e1b158da..117d5629 100644 --- a/src/controllers/OrganizationUnauthorizeController.ts +++ b/src/controllers/OrganizationUnauthorizeController.ts @@ -25,6 +25,7 @@ import { Brackets, IsNull, Not } from "typeorm"; import { OrgRoot } from "../entities/OrgRoot"; import { PosMaster } from "../entities/PosMaster"; import { calculateRetireDate } from "../interfaces/utils"; +import { EmployeePosMaster } from "../entities/EmployeePosMaster"; @Route("api/v1/org/unauthorize") @Tags("OrganizationUnauthorize") @@ -247,6 +248,204 @@ export class OrganizationUnauthorizeController extends Controller { return new HttpSuccess({ data: formattedData, total: total }); } + /** + * API รายชื่อราชการที่เลื่อนเงินเดือน (unauthorize) + * + * @summary ORG_072 - รายชื่อราชการที่เลื่อนเงินเดือน #76 (unauthorize) + * + */ + @Post("salary/employee/gen") + async salaryEmployeeGen( + @Body() + body: { + page: number; + pageSize: number; + keyword?: string; + year: number; + period: string; + }, + ) { + const findRevision = await this.orgRevisionRepository.findOne({ + where: { orgRevisionIsCurrent: true }, + }); + if (!findRevision) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. OrgRevision"); + } + + const [findPosMaster, total] = await AppDataSource.getRepository(EmployeePosMaster) + .createQueryBuilder("employeePosMaster") + .leftJoinAndSelect("employeePosMaster.current_holder", "current_holder") + .leftJoinAndSelect("employeePosMaster.orgRoot", "orgRoot") + .leftJoinAndSelect("employeePosMaster.orgChild1", "orgChild1") + .leftJoinAndSelect("employeePosMaster.orgChild2", "orgChild2") + .leftJoinAndSelect("employeePosMaster.orgChild3", "orgChild3") + .leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4") + .leftJoinAndSelect("employeePosMaster.positions", "positions") + .leftJoinAndSelect("current_holder.profileSalary", "profileSalary") + .leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline") + .leftJoinAndSelect("current_holder.posLevel", "posLevel") + .leftJoinAndSelect("current_holder.posType", "posType") + .where({ + orgRevisionId: findRevision?.id, + current_holderId: Not(IsNull()), + }) + .andWhere( + new Brackets((qb) => { + qb.where( + body.keyword != null && body.keyword != "" + ? "current_holder.prefix LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .orWhere( + body.keyword != null && body.keyword != "" + ? "current_holder.firstName LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .orWhere( + body.keyword != null && body.keyword != "" + ? "current_holder.lastName LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .orWhere( + body.keyword != null && body.keyword != "" + ? "current_holder.position LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + + .orWhere( + body.keyword != null && body.keyword != "" + ? "current_holder.citizenId LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .orWhere( + body.keyword != null && body.keyword != "" + ? "posType.posTypeName LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .orWhere( + body.keyword != null && body.keyword != "" + ? "posLevel.posLevelName LIKE :keyword" + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ); + }), + ) + .orderBy("current_holder.citizenId", "ASC") + .skip((body.page - 1) * body.pageSize) + .take(body.pageSize) + .getManyAndCount(); + if (!findPosMaster) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. PosMaster"); + } + + const formattedData = findPosMaster.map((item) => { + let orgShortName = ""; + + if (item.orgChild1Id === null) { + orgShortName = item.orgRoot?.orgRootShortName; + } else if (item.orgChild2Id === null) { + orgShortName = item.orgChild1?.orgChild1ShortName; + } else if (item.orgChild3Id === null) { + orgShortName = item.orgChild2?.orgChild2ShortName; + } else if (item.orgChild4Id === null) { + orgShortName = item.orgChild3?.orgChild3ShortName; + } else { + orgShortName = item.orgChild4?.orgChild4ShortName; + } + + const amount = + item.current_holder == null || item.current_holder.profileSalary.length == 0 + ? null + : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount; + let datePeriodStart = new Date( + `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ); + let datePeriodEnd = new Date( + `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ); + if (body.period.toLocaleUpperCase() == "APR") { + datePeriodStart = new Date(`${body.year}-03-31T00:00:00.000Z`); + datePeriodEnd = new Date(`${body.year}-03-31T00:00:00.000Z`); + } + if (body.period.toLocaleUpperCase() == "OCT") { + datePeriodStart = new Date(`${body.year}-09-30T00:00:00.000Z`); + datePeriodEnd = new Date(`${body.year}-09-30T00:00:00.000Z`); + } + datePeriodStart = new Date( + new Date(datePeriodStart.setDate(datePeriodStart.getDate() + 1)).setMonth( + datePeriodStart.getMonth() - 6, + ), + ); + return { + prefix: item.current_holder.prefix, + firstName: item.current_holder.firstName, + lastName: item.current_holder.lastName, + citizenId: item.current_holder.citizenId, + posMasterNoPrefix: item.posMasterNoPrefix, + posMasterNo: item.posMasterNo, + posMasterNoSuffix: item.posMasterNoSuffix, + orgShortName: orgShortName, + position: item.current_holder.position, + posType: item.current_holder.posType.posTypeName, + posLevel: item.current_holder.posLevel.posLevelName, + amount: amount ? amount : null, + rootId: item.orgRootId, + root: item.orgRoot?.orgRootName ? item.orgRoot.orgRootName : null, + child1Id: item.orgChild1Id, + child1: item.orgChild1?.orgChild1Name ? item.orgChild1.orgChild1Name : null, + child2Id: item.orgChild2Id, + child2: item.orgChild2?.orgChild2Name ? item.orgChild2.orgChild2Name : null, + child3Id: item.orgChild3Id, + child3: item.orgChild3?.orgChild3Name ? item.orgChild3.orgChild3Name : null, + child4Id: item.orgChild4Id, + child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null, + result: null, + duration: null, + isPunish: + item.current_holder.profileDiscipline.filter( + (x: any) => + new Date( + `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ) >= datePeriodStart && + new Date( + `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ) <= datePeriodEnd, + ).length > 0 + ? true + : false, + isSuspension: item.current_holder.dateRetire == null ? false : true, + isAbsent: false, + isLeave: false, + isRetired: + item.current_holder.birthDate == null || + calculateRetireDate(item.current_holder.birthDate).getFullYear() != body.year + ? false + : true, + }; + }); + return new HttpSuccess({ data: formattedData, total: total }); + } + /** * API หาสำนักทั้งหมด (unauthorize) * diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index b7b7f06f..16467c63 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -271,10 +271,6 @@ export class ProfileEmployeeController extends Controller { return new HttpSuccess({ data: formattedData, total: formattedData.length }); } - // if (!profile) { - // return new HttpSuccess([]); - // } - const formattedData = profile.map((item) => ({ id: item.id, prefix: item.prefix, @@ -1028,10 +1024,10 @@ export class ProfileEmployeeController extends Controller { orgShortName = item.orgChild4?.orgChild4ShortName; } - // const amount = - // item.current_holder == null || item.current_holder.profileSalary.length == 0 - // ? null - // : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount; + const amount = + item.current_holder == null || item.current_holder.profileSalary.length == 0 + ? null + : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount; let datePeriodStart = new Date( `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, ); @@ -1064,9 +1060,7 @@ export class ProfileEmployeeController extends Controller { position: item.current_holder.position, posType: item.current_holder.posType.posTypeName, posLevel: item.current_holder.posLevel.posLevelName, - amount: null, - // amount: amount ? amount : null, - // revisionId: item.orgRevisionId, + amount: amount ? amount : null, rootId: item.orgRootId, root: item.orgRoot?.orgRootName ? item.orgRoot.orgRootName : null, child1Id: item.orgChild1Id, @@ -1079,19 +1073,18 @@ export class ProfileEmployeeController extends Controller { child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null, result: null, duration: null, - isPunish: false, - // isPunish: - // item.current_holder.profileDiscipline.filter( - // (x: any) => - // new Date( - // `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, - // ) >= datePeriodStart && - // new Date( - // `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, - // ) <= datePeriodEnd, - // ).length > 0 - // ? true - // : false, + isPunish: + item.current_holder.profileDiscipline.filter( + (x: any) => + new Date( + `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ) >= datePeriodStart && + new Date( + `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`, + ) <= datePeriodEnd, + ).length > 0 + ? true + : false, isSuspension: item.current_holder.dateRetire == null ? false : true, isAbsent: false, isLeave: false, diff --git a/src/entities/ProfileDisciplineEmployee.ts b/src/entities/ProfileDisciplineEmployee.ts new file mode 100644 index 00000000..70cb6207 --- /dev/null +++ b/src/entities/ProfileDisciplineEmployee.ts @@ -0,0 +1,106 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileEmployee } from "./ProfileEmployee"; +import { ProfileDisciplineEmployeeHistory } from "./ProfileDisciplineEmployeeHistory"; + +@Entity("profileDisciplineEmployee") +export class ProfileDisciplineEmployee extends EntityBase { + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่", + default: null, + }) + date: Date; + + @Column({ + length: 40, + comment: "ไอดีโปรไฟล์", + type: "uuid", + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + comment: "ระดับความผิด", + type: "text", + default: null, + }) + level: string; + + @Column({ + nullable: true, + comment: "รายละเอียด", + type: "text", + default: null, + }) + detail: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + comment: "ล้างมลทิน", + type: "text", + default: null, + }) + unStigma: string; + + @OneToMany( + () => ProfileDisciplineEmployeeHistory, + (profileDisciplineHistory) => profileDisciplineHistory.histories, + ) + profileDisciplineHistories: ProfileDisciplineEmployeeHistory[]; + + @ManyToOne(() => ProfileEmployee, (profile) => profile.profileDiscipline) + @JoinColumn({ name: "profileId" }) + profile: ProfileEmployee; +} + +export class CreateProfileDisciplineEmployee { + @Column() + date: Date | null; + + @Column() + profileId: string; + + @Column() + isActive: boolean | null; + + @Column() + level: string | null; + + @Column() + detail: string | null; + + @Column() + refCommandDate: Date | null; + + @Column() + refCommandNo: string | null; + + @Column() + unStigma: string | null; +} + +export type UpdateProfileDisciplineEmployee = Partial; diff --git a/src/entities/ProfileDisciplineEmployeeHistory.ts b/src/entities/ProfileDisciplineEmployeeHistory.ts new file mode 100644 index 00000000..2b8089c4 --- /dev/null +++ b/src/entities/ProfileDisciplineEmployeeHistory.ts @@ -0,0 +1,74 @@ +import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee"; + +@Entity("profileDisciplineEmployeeHistory") +export class ProfileDisciplineEmployeeHistory extends EntityBase { + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่", + default: null, + }) + date: Date; + + @Column({ + length: 40, + comment: "ล้างมลทิน", + type: "uuid", + }) + profileDisciplineId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + comment: "ระดับความผิด", + type: "text", + default: null, + }) + level: string; + + @Column({ + nullable: true, + comment: "รายละเอียด", + type: "text", + default: null, + }) + detail: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + comment: "ล้างมลทิน", + type: "text", + default: null, + }) + unStigma: string; + + @ManyToOne( + () => ProfileDisciplineEmployee, + (profileDiscipline) => profileDiscipline.profileDisciplineHistories, + ) + @JoinColumn({ name: "profileDisciplineId" }) + histories: ProfileDisciplineEmployee; +} diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index f672c379..c6a75c0e 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -19,6 +19,8 @@ import { ProfileOther } from "./ProfileOther"; import { EmployeePosLevel } from "./EmployeePosLevel"; import { EmployeePosType } from "./EmployeePosType"; import { EmployeePosMaster } from "./EmployeePosMaster"; +import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee"; +import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee"; @Entity("profileEmployee") export class ProfileEmployee extends EntityBase { @@ -145,11 +147,11 @@ export class ProfileEmployee extends EntityBase { @OneToMany(() => EmployeePosMaster, (posMaster) => posMaster.next_holder) next_holders: EmployeePosMaster[]; - // @OneToMany(() => ProfileSalary, (profileSalary) => profileSalary.profile) - // profileSalary: ProfileSalary[]; + @OneToMany(() => ProfileSalaryEmployee, (profileSalary) => profileSalary.profile) + profileSalary: ProfileSalaryEmployee[]; - // @OneToMany(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profile) - // profileDiscipline: ProfileDiscipline[]; + @OneToMany(() => ProfileDisciplineEmployee, (profileDiscipline) => profileDiscipline.profile) + profileDiscipline: ProfileDisciplineEmployee[]; // @OneToMany(() => ProfileCertificate, (profileCertificate) => profileCertificate.profile) // profileCertificates: ProfileCertificate[]; diff --git a/src/entities/ProfileSalaryEmployee.ts b/src/entities/ProfileSalaryEmployee.ts new file mode 100644 index 00000000..6c6783e0 --- /dev/null +++ b/src/entities/ProfileSalaryEmployee.ts @@ -0,0 +1,447 @@ +import { Entity, Column, OneToMany, JoinColumn, ManyToOne, Double } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileSalaryEmployeeHistory } from "./ProfileSalaryEmployeeHistory"; +import { ProfileEmployee } from "./ProfileEmployee"; + +@Entity("profileSalaryEmployee") +export class ProfileSalaryEmployee extends EntityBase { + @Column({ + comment: "วันที่", + type: "datetime", + nullable: true, + }) + date: Date; + + @Column({ + comment: "เงินเดือนฐาน", + default: 0, + nullable: true, + type: "double", + }) + amount: Double; + + @Column({ + comment: "เงินประจำตำแหน่ง", + default: 0, + nullable: true, + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + comment: "เงินค่าตอบแทนรายเดือน", + default: 0, + nullable: true, + type: "double", + }) + mouthSalaryAmount: Double; + + @Column({ + length: 40, + comment: "คีย์นอก(FK)ของตาราง profile", + type: "uuid", + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + comment: "ตำแหน่ง (รายละเอียด)", + type: "text", + default: null, + }) + salaryClass: string; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง", + type: "text", + default: null, + }) + salaryRef: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่ง", + type: "uuid", + default: null, + }) + posNoId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่ง", + type: "uuid", + default: null, + }) + positionId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id สังกัด", + type: "uuid", + default: null, + }) + ocId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ตำแหน่งทางการบริหาร", + type: "uuid", + default: null, + }) + positionExecutiveId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้านทางการบริหาร", + type: "uuid", + default: null, + }) + positionExecutiveSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "", + type: "uuid", + default: null, + }) + positionLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id สายงาน", + type: "uuid", + default: null, + }) + positionLineId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้าน/สาขา", + type: "uuid", + default: null, + }) + positionPathSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ประเภทตำแหน่ง", + type: "uuid", + default: null, + }) + positionTypeId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ชื่อย่อหน่วยงาน", + type: "uuid", + default: null, + }) + organizationShortNameId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id กลุ่มงาน", + type: "uuid", + default: null, + }) + positionEmployeeGroupId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ระดับชั้นงาน", + type: "uuid", + default: null, + }) + positionEmployeeLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ตำแหน่ง", + type: "uuid", + default: null, + }) + positionEmployeePositionId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้านของตำแหน่ง", + type: "uuid", + default: null, + }) + positionEmployeePositionSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่งลูกจ้าง", + default: null, + }) + posNoEmployee: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + comment: "ลำดับ", + default: null, + }) + order: number; + + @Column({ + comment: "เลขที่คำสั่ง", + type: "text", + }) + commandNo: string; + + @Column({ + comment: "ประเภทคำสั่ง", + type: "text", + }) + commandTypeName: string; + + @Column({ + nullable: true, + comment: "ประเภทตำแหน่งกรณีพิเศษ", + type: "text", + default: null, + }) + salaryStatus: string; + + @OneToMany( + () => ProfileSalaryEmployeeHistory, + (profileSalaryHistory) => profileSalaryHistory.histories, + ) + profileSalaryHistories: ProfileSalaryEmployeeHistory[]; + + @ManyToOne(() => ProfileEmployee, (profile) => profile.profileSalary) + @JoinColumn({ name: "profileId" }) + profile: ProfileEmployee; +} + +export class CreateProfileSalaryEmployee { + @Column({ + type: "datetime", + }) + date: Date; + + @Column({ + type: "double", + }) + amount: Double; + + @Column({ + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + type: "double", + }) + mouthSalaryAmount: Double; + + @Column({ + type: "uuid", + }) + profileId: string; + + // @Column() + // isActive: boolean; + + // @Column() + // salaryClass: string | null; + + // @Column() + // salaryRef: string | null; + + // @Column("uuid") + // posNoId: string | null; + + // @Column("uuid") + // positionId: string | null; + + // @Column("uuid") + // ocId: string | null; + + // @Column("uuid") + // positionExecutiveId : string | null; + + // @Column("uuid") + // positionExecutiveSideId : string | null; + + // @Column("uuid") + // positionLevelId : string | null; + + // @Column("uuid") + // positionLineId : string | null; + + // @Column("uuid") + // positionPathSideId : string | null; + + // @Column("uuid") + // positionTypeId : string | null; + + // @Column("uuid") + // organizationShortNameId : string | null; + + // @Column("uuid") + // positionEmployeeGroupId : string | null; + + // @Column("uuid") + // positionEmployeeLevelId : string | null; + + // @Column("uuid") + // positionEmployeePositionId : string | null; + + // @Column("uuid") + // positionEmployeePositionSideId : string | null; + + // @Column() + // posNoEmployee : string | null; + + // @Column() + // refCommandDate: Date | null; + + // @Column() + // refCommandNo: string | null; + + // @Column() + // order: number | null; + + // @Column() + // commandNo: string; + + // @Column() + // commandTypeName: string; + + // @Column() + // salaryStatus: string | null; +} + +export class UpdateProfileSalaryEmployee { + @Column({ + type: "datetime", + }) + date: Date; + + @Column({ + type: "double", + }) + amount: Double; + + @Column({ + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + type: "double", + }) + mouthSalaryAmount: Double; + + // @Column() + // isActive: boolean; + + // @Column() + // salaryClass: string; + + // @Column() + // salaryRef: string; + + // @Column("uuid") + // posNoId: string; + + // @Column("uuid") + // positionId: string; + + // @Column("uuid") + // ocId: string; + + // @Column("uuid") + // positionExecutiveId : string; + + // @Column("uuid") + // positionExecutiveSideId : string; + + // @Column("uuid") + // positionLevelId : string; + + // @Column("uuid") + // positionLineId : string; + + // @Column("uuid") + // positionPathSideId : string; + + // @Column("uuid") + // positionTypeId : string; + + // @Column("uuid") + // organizationShortNameId : string; + + // @Column("uuid") + // positionEmployeeGroupId : string; + + // @Column("uuid") + // positionEmployeeLevelId : string; + + // @Column("uuid") + // positionEmployeePositionId : string; + + // @Column("uuid") + // positionEmployeePositionSideId : string; + + // @Column() + // posNoEmployee : string; + + // @Column() + // refCommandDate: Date; + + // @Column() + // refCommandNo: string; + + // @Column() + // order: number; + + // @Column() + // commandNo: string; + + // @Column() + // commandTypeName: string; + + // @Column() + // salaryStatus: string; +} diff --git a/src/entities/ProfileSalaryEmployeeHistory.ts b/src/entities/ProfileSalaryEmployeeHistory.ts new file mode 100644 index 00000000..855fcc07 --- /dev/null +++ b/src/entities/ProfileSalaryEmployeeHistory.ts @@ -0,0 +1,440 @@ +import { Entity, Column, JoinColumn, ManyToOne, Double } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee"; + +@Entity("profileSalaryEmployeeHistory") +export class ProfileSalaryEmployeeHistory extends EntityBase { + @Column({ + comment: "วันที่", + type: "datetime", + nullable: true, + }) + date: Date; + + @Column({ + comment: "เงินเดือนฐาน", + default: 0, + nullable: true, + type: "double", + }) + amount: Double; + + @Column({ + comment: "เงินประจำตำแหน่ง", + default: 0, + nullable: true, + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + comment: "เงินค่าตอบแทนรายเดือน", + default: 0, + nullable: true, + type: "double", + }) + mouthSalaryAmount: Double; + + @Column({ + length: 40, + comment: "คีย์นอก(FK)ของตาราง profile", + type: "uuid", + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + comment: "ตำแหน่ง (รายละเอียด)", + type: "text", + default: null, + }) + salaryClass: string; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง", + type: "text", + default: null, + }) + salaryRef: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่ง", + type: "uuid", + default: null, + }) + posNoId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่ง", + type: "uuid", + default: null, + }) + positionId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id สังกัด", + type: "uuid", + default: null, + }) + ocId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ตำแหน่งทางการบริหาร", + type: "uuid", + default: null, + }) + positionExecutiveId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้านทางการบริหาร", + type: "uuid", + default: null, + }) + positionExecutiveSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "", + type: "uuid", + default: null, + }) + positionLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id สายงาน", + type: "uuid", + default: null, + }) + positionLineId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้าน/สาขา", + type: "uuid", + default: null, + }) + positionPathSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ประเภทตำแหน่ง", + type: "uuid", + default: null, + }) + positionTypeId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ชื่อย่อหน่วยงาน", + type: "uuid", + default: null, + }) + organizationShortNameId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id กลุ่มงาน", + type: "uuid", + default: null, + }) + positionEmployeeGroupId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ระดับชั้นงาน", + type: "uuid", + default: null, + }) + positionEmployeeLevelId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ตำแหน่ง", + type: "uuid", + default: null, + }) + positionEmployeePositionId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id ด้านของตำแหน่ง", + type: "uuid", + default: null, + }) + positionEmployeePositionSideId: string; + + @Column({ + nullable: true, + length: 40, + comment: "Id เลขที่ตำแหน่งลูกจ้าง", + default: null, + }) + posNoEmployee: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + comment: "ลำดับ", + default: null, + }) + order: number; + + @Column({ + comment: "เลขที่คำสั่ง", + type: "text", + }) + commandNo: string; + + @Column({ + comment: "ประเภทคำสั่ง", + type: "text", + }) + commandTypeName: string; + + @Column({ + nullable: true, + comment: "ประเภทตำแหน่งกรณีพิเศษ", + type: "text", + default: null, + }) + salaryStatus: string; + + @ManyToOne(() => ProfileSalaryEmployee, (profileSalary) => profileSalary.profileSalaryHistories) + @JoinColumn({ name: "profileSalaryId" }) + histories: ProfileSalaryEmployee; +} + +export class CreateProfileSalaryEmployeeHistory { + @Column({ + type: "datetime", + }) + date: Date; + + @Column({ + type: "double", + }) + amount: Double; + + @Column({ + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + type: "double", + }) + mouthSalaryAmount: Double; + + @Column({ + type: "uuid", + }) + profileId: string; + + // @Column() + // isActive: boolean; + + // @Column() + // salaryClass: string | null; + + // @Column() + // salaryRef: string | null; + + // @Column("uuid") + // posNoId: string | null; + + // @Column("uuid") + // positionId: string | null; + + // @Column("uuid") + // ocId: string | null; + + // @Column("uuid") + // positionExecutiveId : string | null; + + // @Column("uuid") + // positionExecutiveSideId : string | null; + + // @Column("uuid") + // positionLevelId : string | null; + + // @Column("uuid") + // positionLineId : string | null; + + // @Column("uuid") + // positionPathSideId : string | null; + + // @Column("uuid") + // positionTypeId : string | null; + + // @Column("uuid") + // organizationShortNameId : string | null; + + // @Column("uuid") + // positionEmployeeGroupId : string | null; + + // @Column("uuid") + // positionEmployeeLevelId : string | null; + + // @Column("uuid") + // positionEmployeePositionId : string | null; + + // @Column("uuid") + // positionEmployeePositionSideId : string | null; + + // @Column() + // posNoEmployee : string | null; + + // @Column() + // refCommandDate: Date | null; + + // @Column() + // refCommandNo: string | null; + + // @Column() + // order: number | null; + + // @Column() + // commandNo: string; + + // @Column() + // commandTypeName: string; + + // @Column() + // salaryStatus: string | null; +} + +export class UpdateProfileSalaryEmployeeHistory { + @Column({ + type: "datetime", + }) + date: Date; + + @Column({ + type: "double", + }) + amount: Double; + + @Column({ + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + type: "double", + }) + mouthSalaryAmount: Double; + + // @Column() + // isActive: boolean; + + // @Column() + // salaryClass: string | null; + + // @Column() + // salaryRef: string | null; + + // @Column("uuid") + // posNoId: string | null; + + // @Column("uuid") + // positionId: string | null; + + // @Column("uuid") + // ocId: string | null; + + // @Column("uuid") + // positionExecutiveId : string | null; + + // @Column("uuid") + // positionExecutiveSideId : string | null; + + // @Column("uuid") + // positionLevelId : string | null; + + // @Column("uuid") + // positionLineId : string | null; + + // @Column("uuid") + // positionPathSideId : string | null; + + // @Column("uuid") + // positionTypeId : string | null; + + // @Column("uuid") + // organizationShortNameId : string | null; + + // @Column("uuid") + // positionEmployeeGroupId : string | null; + + // @Column("uuid") + // positionEmployeeLevelId : string | null; + + // @Column("uuid") + // positionEmployeePositionId : string | null; + + // @Column("uuid") + // positionEmployeePositionSideId : string | null; + + // @Column() + // posNoEmployee : string | null; + + // @Column() + // refCommandDate: Date | null; + + // @Column() + // refCommandNo: string | null; + + // @Column() + // order: number | null; + + // @Column() + // commandNo: string; + + // @Column() + // commandTypeName: string; + + // @Column() + // salaryStatus: string | null; +} diff --git a/src/migration/1710565430715-add_table_profilesalaryemployee.ts b/src/migration/1710565430715-add_table_profilesalaryemployee.ts new file mode 100644 index 00000000..ae6c96ad --- /dev/null +++ b/src/migration/1710565430715-add_table_profilesalaryemployee.ts @@ -0,0 +1,28 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AddTableProfilesalaryemployee1710565430715 implements MigrationInterface { + name = 'AddTableProfilesalaryemployee1710565430715' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`CREATE TABLE \`profileSalaryEmployeeHistory\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0', \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0', \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)', \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง', \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด', \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร', \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร', \`positionLevelId\` varchar(40) NULL, \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน', \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา', \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง', \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน', \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน', \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน', \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง', \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง', \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`order\` int NULL COMMENT 'ลำดับ', \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง', \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง', \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ', \`profileSalaryId\` varchar(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + await queryRunner.query(`CREATE TABLE \`profileDisciplineEmployeeHistory\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`profileDisciplineId\` varchar(40) NOT NULL COMMENT 'ล้างมลทิน', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`level\` text NULL COMMENT 'ระดับความผิด', \`detail\` text NULL COMMENT 'รายละเอียด', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`unStigma\` text NULL COMMENT 'ล้างมลทิน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + await queryRunner.query(`CREATE TABLE \`profileDisciplineEmployee\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`profileId\` varchar(40) NOT NULL COMMENT 'ไอดีโปรไฟล์', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`level\` text NULL COMMENT 'ระดับความผิด', \`detail\` text NULL COMMENT 'รายละเอียด', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`unStigma\` text NULL COMMENT 'ล้างมลทิน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + await queryRunner.query(`CREATE TABLE \`profileSalaryEmployee\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0', \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0', \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)', \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง', \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด', \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร', \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร', \`positionLevelId\` varchar(40) NULL, \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน', \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา', \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง', \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน', \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน', \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน', \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง', \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง', \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`order\` int NULL COMMENT 'ลำดับ', \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง', \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง', \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + await queryRunner.query(`ALTER TABLE \`profileSalaryEmployeeHistory\` ADD CONSTRAINT \`FK_3a5e3b1bfea204cbbf095acea0f\` FOREIGN KEY (\`profileSalaryId\`) REFERENCES \`profileSalaryEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`profileDisciplineEmployeeHistory\` ADD CONSTRAINT \`FK_690234b4b797340d6ceea505484\` FOREIGN KEY (\`profileDisciplineId\`) REFERENCES \`profileDisciplineEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`profileDisciplineEmployee\` ADD CONSTRAINT \`FK_91bb620891d3e21cacadb1bba4c\` FOREIGN KEY (\`profileId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`profileSalaryEmployee\` ADD CONSTRAINT \`FK_d9c86788039c9e116cb10567408\` FOREIGN KEY (\`profileId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryEmployee\` DROP FOREIGN KEY \`FK_d9c86788039c9e116cb10567408\``); + await queryRunner.query(`ALTER TABLE \`profileDisciplineEmployee\` DROP FOREIGN KEY \`FK_91bb620891d3e21cacadb1bba4c\``); + await queryRunner.query(`ALTER TABLE \`profileDisciplineEmployeeHistory\` DROP FOREIGN KEY \`FK_690234b4b797340d6ceea505484\``); + await queryRunner.query(`ALTER TABLE \`profileSalaryEmployeeHistory\` DROP FOREIGN KEY \`FK_3a5e3b1bfea204cbbf095acea0f\``); + await queryRunner.query(`DROP TABLE \`profileSalaryEmployee\``); + await queryRunner.query(`DROP TABLE \`profileDisciplineEmployee\``); + await queryRunner.query(`DROP TABLE \`profileDisciplineEmployeeHistory\``); + await queryRunner.query(`DROP TABLE \`profileSalaryEmployeeHistory\``); + } + +}