From 693afa4e5fc4bfb18de7d7b55186286167f3644a Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 13 Jun 2024 14:18:20 +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/ChangePositionController.ts | 2 +- src/entities/AuthRole.ts | 6 +++++- src/entities/PosMaster.ts | 11 +++++++++++ src/entities/ProfileChangePosition.ts | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/controllers/ChangePositionController.ts b/src/controllers/ChangePositionController.ts index 516c0dde..9cffa825 100644 --- a/src/controllers/ChangePositionController.ts +++ b/src/controllers/ChangePositionController.ts @@ -339,7 +339,7 @@ export class ChangePositionController extends Controller { profileChangePos.posMasterNoOld = body.posMasterNoOld; profileChangePos.positionTypeOld = body.positionTypeOld; profileChangePos.positionLevelOld = body.positionLevelOld; - profileChangePos.positionNumberOld = body.positionNumberOld; + profileChangePos.organizationPositionOld = body.organizationPositionOld; profileChangePos.amountOld = body.amountOld; profileChangePos.reason = body.reason? String(body.reason) : ""; profileChangePos.dateCurrent = body.dateCurrent; diff --git a/src/entities/AuthRole.ts b/src/entities/AuthRole.ts index 9f197cd9..1cc3cbe7 100644 --- a/src/entities/AuthRole.ts +++ b/src/entities/AuthRole.ts @@ -1,6 +1,7 @@ -import { Entity, Column, OneToMany } from "typeorm"; +import { Entity, Column, OneToMany, OneToOne } from "typeorm"; import { EntityBase } from "./base/Base"; import { AuthRoleAttr } from "./AuthRoleAttr"; +import { PosMaster } from "./PosMaster"; @Entity("authRole") export class AuthRole extends EntityBase { @@ -22,6 +23,9 @@ export class AuthRole extends EntityBase { @OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForRole) authRoles: AuthRoleAttr[]; + + @OneToOne(() => PosMaster, (posMaster) => posMaster.authRole) + posMaster: PosMaster; } export class CreateAuthRole { diff --git a/src/entities/PosMaster.ts b/src/entities/PosMaster.ts index 5fc8d032..f181deb2 100644 --- a/src/entities/PosMaster.ts +++ b/src/entities/PosMaster.ts @@ -9,6 +9,7 @@ import { OrgChild2 } from "./OrgChild2"; import { OrgChild3 } from "./OrgChild3"; import { OrgChild4 } from "./OrgChild4"; import { Profile } from "./Profile"; +import { AuthRole } from "./AuthRole"; enum PosMasterLine { MAIN = "MAIN", @@ -170,6 +171,16 @@ export class PosMaster extends EntityBase { }) orgRevisionId: string; //fk + @Column({ + length: 40, + comment: "คีย์นอก(FK)ของตาราง authRole", + }) + authRoleId: string; + + @OneToOne(() => AuthRole, (authRole) => authRole.posMaster) + @JoinColumn({ name: "authRoleId" }) + authRole: AuthRole; + @ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.posMasters) @JoinColumn({ name: "orgRevisionId" }) orgRevision: OrgRevision; diff --git a/src/entities/ProfileChangePosition.ts b/src/entities/ProfileChangePosition.ts index f7f40f06..38ea5dfb 100644 --- a/src/entities/ProfileChangePosition.ts +++ b/src/entities/ProfileChangePosition.ts @@ -255,7 +255,7 @@ export type UpdateProfileChangePosition = { posMasterNoOld: number; positionTypeOld: string; positionLevelOld: string; - positionNumberOld: string; + organizationPositionOld: string; amountOld: number; dateCurrent : Date; reason: string | null;