From bfe7daa63d24ac980882e1c9403c84771be49946 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 14 Jun 2024 12:28:09 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B8=94=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/EmployeePositionController.ts | 9 ++++++++- src/controllers/PositionController.ts | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 66ed5957..2634d406 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -35,7 +35,7 @@ import { OrgChild2 } from "../entities/OrgChild2"; import { OrgChild3 } from "../entities/OrgChild3"; import { OrgChild4 } from "../entities/OrgChild4"; import { ProfileEmployee } from "../entities/ProfileEmployee"; - +import { AuthRole } from "../entities/AuthRole"; @Route("api/v1/org/employee/pos") @Tags("Employee") @Security("bearerAuth") @@ -57,6 +57,7 @@ export class EmployeePositionController extends Controller { private child2Repository = AppDataSource.getRepository(OrgChild2); private child3Repository = AppDataSource.getRepository(OrgChild3); private child4Repository = AppDataSource.getRepository(OrgChild4); + private authRoleRepo = AppDataSource.getRepository(AuthRole); /** * API เพิ่มตำแหน่งลูกจ้างประจำ @@ -1054,6 +1055,10 @@ export class EmployeePositionController extends Controller { relations: ["posLevel", "posType"], }); + const authRoleName = await this.authRoleRepo.findOne({ + where: { id: String(posMaster.authRoleId) } + }); + let profile: any; const chkRevision = await this.orgRevisionRepository.findOne({ where: { id: posMaster.orgRevisionId }, @@ -1143,6 +1148,8 @@ export class EmployeePositionController extends Controller { profilePostype: type == null ? null : type.posTypeName, profilePoslevel: level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`, + authRoleId: posMaster.authRoleId, + authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName, positions: positions.map((position) => ({ id: position.id, positionName: position.positionName, diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 4adb27f1..2488ccfb 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -37,6 +37,7 @@ import { Profile } from "../entities/Profile"; import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosType } from "../entities/EmployeePosType"; import { EmployeePosLevel } from "../entities/EmployeePosLevel"; +import { AuthRole } from "../entities/AuthRole"; @Route("api/v1/org/pos") @Tags("Position") @Security("bearerAuth") @@ -61,6 +62,7 @@ export class PositionController extends Controller { private child2Repository = AppDataSource.getRepository(OrgChild2); private child3Repository = AppDataSource.getRepository(OrgChild3); private child4Repository = AppDataSource.getRepository(OrgChild4); + private authRoleRepo = AppDataSource.getRepository(AuthRole); /** * API เพิ่มตำแหน่ง @@ -1271,6 +1273,10 @@ export class PositionController extends Controller { }, }); + const authRoleName = await this.authRoleRepo.findOne({ + where: { id: String(posMaster.authRoleId) } + }); + let profile: any; const chkRevision = await this.orgRevisionRepository.findOne({ where: { id: posMaster.orgRevisionId }, @@ -1359,6 +1365,8 @@ export class PositionController extends Controller { profilePosition: profile == null || profile.position == null ? null : profile.position, profilePostype: type == null || type.posTypeName == null ? null : type.posTypeName, profilePoslevel: level == null || level.posLevelName == null ? null : level.posLevelName, + authRoleId: posMaster.authRoleId, + authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName, positions: positions.map((position: any) => ({ id: position.id, positionName: position.positionName,