From 8afaff0d6b433a451490fd9149461ea5d4b6840a Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 18 Mar 2024 14:53:24 +0700 Subject: [PATCH] no message --- src/controllers/OrganizationUnauthorizeController.ts | 6 ++++-- src/controllers/PositionController.ts | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/controllers/OrganizationUnauthorizeController.ts b/src/controllers/OrganizationUnauthorizeController.ts index 2dc2ab4a..10bf8531 100644 --- a/src/controllers/OrganizationUnauthorizeController.ts +++ b/src/controllers/OrganizationUnauthorizeController.ts @@ -407,8 +407,10 @@ export class OrganizationUnauthorizeController extends Controller { posMasterNoSuffix: item.posMasterNoSuffix, orgShortName: orgShortName, position: item.current_holder.position, - posType: item.current_holder.posType.posTypeName, - posLevel: item.current_holder.posLevel.posLevelName, + posType: + item.current_holder.posType == null ? null : item.current_holder.posType.posTypeName, + posLevel: + item.current_holder.posLevel == null ? null : item.current_holder.posLevel.posLevelName, amount: amount ? amount : null, rootId: item.orgRootId, root: item.orgRoot?.orgRootName ? item.orgRoot.orgRootName : null, diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 929e02a9..2f9973c1 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -159,10 +159,14 @@ export class PositionController extends Controller { requestBody: CreatePosDictExe, @Request() request: { user: Record }, ) { - const posDict = Object.assign(new PosDict(), requestBody); - if (!posDict) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } + let posDict: any; + posDict.posDictName = requestBody.posDictName; + posDict.posDictField = requestBody.posDictField; + posDict.posTypeId = requestBody.posTypeId; + posDict.posLevelId = requestBody.posLevelId; + posDict.posDictExecutiveField = requestBody.posDictExecutiveField; + posDict.posDictArea = requestBody.posDictArea; + posDict.isSpecial = requestBody.isSpecial; const checkPosTypeId = await this.posTypeRepository.findOne({ where: { id: posDict.posTypeId },