From d85fffe0820ebe703846f5cee1a82a78c6c50013 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 19 Jul 2024 11:52:43 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=84=E0=B8=99=E0=B9=80=E0=B8=82?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=AA?= =?UTF-8?q?=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B9=81=E0=B8=A5=E0=B9=89?= =?UTF-8?q?=E0=B8=A7=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=97=E0=B8=B5?= =?UTF-8?q?=E0=B9=88profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/EmployeePositionController.ts | 32 +++++++++++-------- src/controllers/PositionController.ts | 4 +++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 6011a253..7534803d 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -2203,24 +2203,24 @@ export class EmployeePositionController extends Controller { const positionOld = await this.employeePositionRepository.findOne({ where: { posMasterId: posMasterOld?.id, - positionIsSelected: true - } - }) + positionIsSelected: true, + }, + }); if (positionOld != null) { - positionOld.positionIsSelected = false + positionOld.positionIsSelected = false; await this.employeePositionRepository.save(positionOld); } const checkPosition = await this.employeePositionRepository.find({ where: { posMasterId: body.posmasterId, - positionIsSelected: true - } - }) + positionIsSelected: true, + }, + }); if (checkPosition.length > 0) { - const clearPosition = checkPosition.map(positions => ({ + const clearPosition = checkPosition.map((positions) => ({ ...positions, - positionIsSelected: false + positionIsSelected: false, })); await this.employeePositionRepository.save(clearPosition); } @@ -2239,11 +2239,15 @@ export class EmployeePositionController extends Controller { const positionNew = await this.employeePositionRepository.findOne({ where: { id: body.positionId, - posMasterId: body.posmasterId - } - }) - if(positionNew != null) { - positionNew.positionIsSelected = true + posMasterId: body.posmasterId, + }, + }); + if (positionNew != null) { + positionNew.positionIsSelected = true; + profile.posLevel = positionNew.posLevel; + profile.posType = positionNew.posType; + profile.position = positionNew.positionName; + await this.profileRepository.save(profile); await this.employeePositionRepository.save(positionNew); } return new HttpSuccess(); diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 280e358e..af8eafd3 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -3417,6 +3417,10 @@ export class PositionController extends Controller { }); if (positionNew != null) { positionNew.positionIsSelected = true; + profile.posLevel = positionNew.posLevel; + profile.posType = positionNew.posType; + profile.position = positionNew.positionName; + await this.profileRepository.save(profile); await this.positionRepository.save(positionNew); } return new HttpSuccess(); From 8445a9ed0843ba9c59b09d95ad587132664f875a Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 19 Jul 2024 14:32:59 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=9F=E0=B8=B4=E0=B8=A7=E0=B9=80=E0=B8=A3=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4?= =?UTF-8?q?=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/AuthRoleAttr.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/entities/AuthRoleAttr.ts b/src/entities/AuthRoleAttr.ts index e673da1a..a6022079 100644 --- a/src/entities/AuthRoleAttr.ts +++ b/src/entities/AuthRoleAttr.ts @@ -7,45 +7,45 @@ import { AuthRole } from "./AuthRole"; export class AuthRoleAttr extends EntityBase { @Column({ nullable: true, - comment: "", + comment: "ความเป็นเจ้าของ (Ownership)", length: 255, default: null, }) attrOwnership: string; @Column({ - comment: "", + comment: "สิทธิ์ดำเนินการ (Permission) การ Create", default: false, }) attrIsCreate: boolean; @Column({ - comment: "", + comment: "สิทธิ์ดำเนินการ (Permission) การ List", default: false, }) attrIsList: boolean; @Column({ - comment: "", + comment: "สิทธิ์ดำเนินการ (Permission) การ Get", default: false, }) attrIsGet: boolean; @Column({ - comment: "", + comment: "สิทธิ์ดำเนินการ (Permission) การ Update", default: false, }) attrIsUpdate: boolean; @Column({ - comment: "", + comment: "สิทธิ์ดำเนินการ (Permission) การ Delete", default: false, }) attrIsDelete: boolean; @Column({ nullable: true, - comment: "", + comment: "สิทธิการเข้าถึง(Privilege)", length: 255, default: null, })