From 2977969bada7de0bf7930b132d881638e40a1ee2 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 19 Dec 2024 12:01:27 +0700 Subject: [PATCH 1/4] no message --- src/controllers/OrganizationController.ts | 141 ++++++++++++++++------ 1 file changed, 106 insertions(+), 35 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index a8b65973..ff6e3872 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -58,6 +58,17 @@ export class OrganizationController extends Controller { private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster); private employeePositionRepository = AppDataSource.getRepository(EmployeePosition); + /** + * API ล้างข้อมูล + * + * @summary ล้างข้อมูล + * + */ + @Get("clear-db") + async ClearDb() { + return new HttpSuccess(); + } + /** * API รายการประวัติโครงสร้าง * @@ -2665,7 +2676,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id }, }), @@ -2789,7 +2805,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, @@ -2923,7 +2944,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, @@ -3064,7 +3090,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, @@ -5894,9 +5925,14 @@ export class OrganizationController extends Controller { orgRoot.orgRootCode + orgChild1.orgChild1Code + " " + - orgChild1.orgChild1ShortName + + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, posMaster: await Promise.all( orgChild1.posMasters .filter( @@ -5946,7 +5982,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, posMaster: await Promise.all( orgChild2.posMasters .filter( @@ -6003,7 +6044,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, posMaster: await Promise.all( orgChild3.posMasters .filter( @@ -6067,7 +6113,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, posMaster: await Promise.all( orgChild4.posMasters .filter( @@ -6474,7 +6525,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, orgChild1Id: orgChild1.id }, }), @@ -6598,7 +6654,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, @@ -6710,29 +6771,34 @@ export class OrganizationController extends Controller { orgRevisionId: orgRoot.orgRevisionId, orgRootName: orgRoot.orgRootName, responsibility: orgChild3.responsibility, - labelName: - orgChild3.orgChild3Name + - " " + - orgRoot.orgRootCode + - orgChild3.orgChild3Code + - " " + - orgChild3.orgChild3ShortName + - "/" + - orgChild2.orgChild2Name + - " " + - orgRoot.orgRootCode + - orgChild2.orgChild2Code + - " " + - orgChild2.orgChild2ShortName + - "/" + - orgChild1.orgChild1Name + - " " + - orgRoot.orgRootCode + - orgChild1.orgChild1Code + - " " + - orgChild1.orgChild1ShortName + - "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + labelName: + orgChild3.orgChild3Name + + " " + + orgRoot.orgRootCode + + orgChild3.orgChild3Code + + " " + + orgChild3.orgChild3ShortName + + "/" + + orgChild2.orgChild2Name + + " " + + orgRoot.orgRootCode + + orgChild2.orgChild2Code + + " " + + orgChild2.orgChild2ShortName + + "/" + + orgChild1.orgChild1Name + + " " + + orgRoot.orgRootCode + + orgChild1.orgChild1Code + + " " + + orgChild1.orgChild1ShortName + + "/" + + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, @@ -6873,7 +6939,12 @@ export class OrganizationController extends Controller { " " + orgChild1.orgChild1ShortName + "/" + - orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName, + orgRoot.orgRootName + + " " + + orgRoot.orgRootCode + + "00" + + " " + + orgRoot.orgRootShortName, totalPosition: await this.posMasterRepository.count({ where: { orgRevisionId: orgRoot.orgRevisionId, From 2a63855b72d05aa31f1691e2447ead61d79dc3a7 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 19 Dec 2024 14:53:35 +0700 Subject: [PATCH 2/4] edit searcg profile --- src/controllers/ProfileController.ts | 40 +++--------------- src/controllers/ProfileEmployeeController.ts | 36 ++++------------ .../ProfileEmployeeTempController.ts | 42 ++++--------------- 3 files changed, 21 insertions(+), 97 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 1746b521..f533dfc7 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -6017,7 +6017,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6062,7 +6061,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6117,7 +6115,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6143,7 +6140,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6169,7 +6165,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6192,7 +6187,6 @@ export class ProfileController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -6248,17 +6242,6 @@ export class ProfileController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const rootHolder = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.orgRoot; @@ -6301,7 +6284,7 @@ export class ProfileController extends Controller { positionTypeName: item.posType?.posTypeName, posNo: shortName, organization: root == null ? null : root.orgRootName, - salary: salary == "" ? "" : salary.amount, + salary: item.amount, root: rootHolder?.orgRootName ?? null, rootId: rootHolder?.id ?? null, rootShortName: rootHolder?.orgRootShortName ?? null, @@ -7712,7 +7695,7 @@ export class ProfileController extends Controller { keycloak: IsNull(), citizenId: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -7724,7 +7707,7 @@ export class ProfileController extends Controller { keycloak: IsNull(), firstName: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -7736,7 +7719,7 @@ export class ProfileController extends Controller { keycloak: IsNull(), lastName: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -7747,7 +7730,7 @@ export class ProfileController extends Controller { where: { keycloak: IsNull(), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -7797,17 +7780,6 @@ export class ProfileController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const posMasterNo = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.posMasterNo; @@ -7835,7 +7807,7 @@ export class ProfileController extends Controller { positionTypeName: item.posType?.posTypeName, posNo: shortName, organization: root == null ? null : root.orgRootShortName, - salary: salary == "" ? "" : salary.amount, + salary: item.amount, posMasterNo: posMasterNo ?? null, posTypeId: item.posTypeId, posTypeName: item.posType?.posTypeName, diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index b8c3916d..4dd10a4b 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2351,17 +2351,6 @@ export class ProfileEmployeeController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const rootHolder = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.orgRoot; @@ -2403,8 +2392,8 @@ export class ProfileEmployeeController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootName, - salary: salary == "" ? "" : salary.amount, + organization: root == null ? null : root.orgRootShortName, + salary: item.amount, root: rootHolder?.orgRootName ?? null, rootId: rootHolder?.id ?? null, rootShortName: rootHolder?.orgRootShortName ?? null, @@ -3927,7 +3916,7 @@ export class ProfileEmployeeController extends Controller { citizenId: Like(`%${body.keyword}%`), employeeClass: "PREM", }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3940,7 +3929,7 @@ export class ProfileEmployeeController extends Controller { firstName: Like(`%${body.keyword}%`), employeeClass: "PREM", }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3953,7 +3942,7 @@ export class ProfileEmployeeController extends Controller { lastName: Like(`%${body.keyword}%`), employeeClass: "PREM", }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3965,7 +3954,7 @@ export class ProfileEmployeeController extends Controller { keycloak: IsNull(), employeeClass: "PREM", }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -4015,17 +4004,6 @@ export class ProfileEmployeeController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const posMasterNo = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.posMasterNo; @@ -4053,7 +4031,7 @@ export class ProfileEmployeeController extends Controller { positionTypeName: item.posType?.posTypeName, posNo: shortName, organization: root == null ? null : root.orgRootShortName, - salary: salary == "" ? "" : salary.amount, + salary: item.amount, posMasterNo: posMasterNo ?? null, posTypeId: item.posTypeId, posTypeName: item.posType?.posTypeName, diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index eb707207..b1050c20 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -1898,7 +1898,6 @@ export class ProfileEmployeeTempController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -1917,7 +1916,6 @@ export class ProfileEmployeeTempController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -1936,7 +1934,6 @@ export class ProfileEmployeeTempController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -1954,7 +1951,6 @@ export class ProfileEmployeeTempController extends Controller { "posType", "posLevel", "current_holders", - "profileSalary", "current_holders.orgRoot", "current_holders.orgChild1", "current_holders.orgChild2", @@ -2010,17 +2006,6 @@ export class ProfileEmployeeTempController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const rootHolder = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.orgRoot; @@ -2062,8 +2047,8 @@ export class ProfileEmployeeTempController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootShortName, - salary: salary == "" ? "" : salary.amount, + organization: root == null ? null : root.orgRootName, + salary: item.amount, root: rootHolder?.orgRootName ?? null, rootId: rootHolder?.id ?? null, rootShortName: rootHolder?.orgRootShortName ?? null, @@ -3478,7 +3463,7 @@ export class ProfileEmployeeTempController extends Controller { keycloak: IsNull(), citizenId: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3490,7 +3475,7 @@ export class ProfileEmployeeTempController extends Controller { keycloak: IsNull(), firstName: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3502,7 +3487,7 @@ export class ProfileEmployeeTempController extends Controller { keycloak: IsNull(), lastName: Like(`%${body.keyword}%`), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3513,7 +3498,7 @@ export class ProfileEmployeeTempController extends Controller { where: { keycloak: IsNull(), }, - relations: ["posType", "posLevel", "current_holders", "profileSalary"], + relations: ["posType", "posLevel", "current_holders"], skip, take, }); @@ -3563,17 +3548,6 @@ export class ProfileEmployeeTempController extends Controller { ? null : item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; - let salary: any = ""; - if (item != null && item.profileSalary != null && item.profileSalary.length > 0) { - let _salary: any = item.profileSalary.sort( - (a, b) => - (b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()), - ); - if (_salary.length > 0) { - salary = _salary[0]; - } - } - const posMasterNo = item.current_holders?.find( (x) => x.orgRevisionId == findRevision.id, )?.posMasterNo; @@ -3600,8 +3574,8 @@ export class ProfileEmployeeTempController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootShortName, - salary: salary == "" ? "" : salary.amount, + organization: root == null ? null : root.orgRootName, + salary: item.amount, posMasterNo: posMasterNo ?? null, posTypeId: item.posTypeId, posTypeName: item.posType?.posTypeName, From 0d198ec00933d2b002252246e72d0373b0297185 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 19 Dec 2024 15:23:05 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=97?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=20Indivi?= =?UTF-8?q?dual=20Development=20Plan=20#875?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileDevelopmentController.ts | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/controllers/ProfileDevelopmentController.ts b/src/controllers/ProfileDevelopmentController.ts index d102f423..b9017db8 100644 --- a/src/controllers/ProfileDevelopmentController.ts +++ b/src/controllers/ProfileDevelopmentController.ts @@ -27,6 +27,7 @@ import { import permission from "../interfaces/permission"; import { DevelopmentProject } from "../entities/DevelopmentProject"; import { In, Brackets } from "typeorm"; +import { DevelopmentRequest } from "../entities/DevelopmentRequest"; @Route("api/v1/org/profile/development") @Tags("ProfileDevelopment") @Security("bearerAuth") @@ -35,6 +36,7 @@ export class ProfileDevelopmentController extends Controller { private developmentRepository = AppDataSource.getRepository(ProfileDevelopment); private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory); private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject); + private developmentRequestRepository = AppDataSource.getRepository(DevelopmentRequest); @Get("user") public async getDevelopmentUser(@Request() request: { user: Record }) { @@ -121,6 +123,75 @@ export class ProfileDevelopmentController extends Controller { return new HttpSuccess(record); } + @Get("registry/{type}/{developmentId}") + public async developmentDetail( + @Path() developmentId: string, + @Path() type: string, + @Request() req: RequestWithUser + ) { + const data = await this.developmentRequestRepository.findOne({ + where: { id: developmentId }, + relations: ["developmentProjects"], + }); + if (!data) + throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบรายการพัฒนารายบุคคลดังกล่าว"); + + if (type.trim().toLocaleUpperCase() == "OFFICER") { + let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_OFFICER"); + if (_workflow == false) + await new permission().PermissionOrgUserGet( + req, + "SYS_REGISTRY_OFFICER", + data.profileId, + ); + } else if (type.trim().toLocaleUpperCase() == "EMPLOYEE") { + let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_EMP"); + if (_workflow == false) + await new permission().PermissionOrgUserGet( + req, + "SYS_REGISTRY_EMP", + data.profileEmployeeId, + ); + } else if (type.trim().toLocaleUpperCase() == "TEMP") { + let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_TEMP"); + if (_workflow == false) + await new permission().PermissionOrgUserGet( + req, + "SYS_REGISTRY_TEMP", + data.profileEmployeeId, + ); + } else if (type.trim().toLocaleUpperCase() == "USER") { + } else { + throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถเข้าถึงข้อมูลนี้ได้"); + } + + const _mapData = { + id: data.id, + evaluationId: null, + target: data.developmentTarget, + summary: null, + point: null, + name: data.name, + achievement10: "มีผลการพัฒนาและมีการดำเนินการตามเป้าหมายการนำไปพัฒนางาน1", + achievement5: "มีผลการพัฒนาแต่ยังไม่ได้ดำเนินการตามเป้าหมายการนำไปพัฒนางาน", + achievement0: "ไม่ได้ดำเนินการพัฒนา", + isDevelopment70: data.isDevelopment70, + isDevelopment20: data.isDevelopment20, + isDevelopment10: data.isDevelopment10, + reasonDevelopment70: data.reasonDevelopment70, + reasonDevelopment20: data.reasonDevelopment20, + reasonDevelopment10: data.reasonDevelopment10, + selectType: null, + selectTypeYear: null, + selectTypeId: null + } + const _data = { + ..._mapData, + developmentProjects: data.developmentProjects.map((x) => x.name), + }; + return new HttpSuccess(_data); + } + @Post() public async newDevelopment( @Request() req: RequestWithUser, From 39b78588f4ba36c7d87c89f2638186eb0d0a4c1c Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 19 Dec 2024 15:46:14 +0700 Subject: [PATCH 4/4] no message --- src/controllers/ProfileController.ts | 2 +- src/controllers/ProfileEmployeeController.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index f533dfc7..ed5a1e4b 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -7806,7 +7806,7 @@ export class ProfileController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootShortName, + organization: root == null ? null : root.orgRootName, salary: item.amount, posMasterNo: posMasterNo ?? null, posTypeId: item.posTypeId, diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 4dd10a4b..d9d2f070 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2392,7 +2392,7 @@ export class ProfileEmployeeController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootShortName, + organization: root == null ? null : root.orgRootName, salary: item.amount, root: rootHolder?.orgRootName ?? null, rootId: rootHolder?.id ?? null, @@ -4030,7 +4030,7 @@ export class ProfileEmployeeController extends Controller { positionType: item.posTypeId, positionTypeName: item.posType?.posTypeName, posNo: shortName, - organization: root == null ? null : root.orgRootShortName, + organization: root == null ? null : root.orgRootName, salary: item.amount, posMasterNo: posMasterNo ?? null, posTypeId: item.posTypeId,