เพิ่มฟิลด์

This commit is contained in:
Bright 2024-06-13 14:18:20 +07:00
parent 4cccf6f685
commit 693afa4e5f
4 changed files with 18 additions and 3 deletions

View file

@ -339,7 +339,7 @@ export class ChangePositionController extends Controller {
profileChangePos.posMasterNoOld = body.posMasterNoOld; profileChangePos.posMasterNoOld = body.posMasterNoOld;
profileChangePos.positionTypeOld = body.positionTypeOld; profileChangePos.positionTypeOld = body.positionTypeOld;
profileChangePos.positionLevelOld = body.positionLevelOld; profileChangePos.positionLevelOld = body.positionLevelOld;
profileChangePos.positionNumberOld = body.positionNumberOld; profileChangePos.organizationPositionOld = body.organizationPositionOld;
profileChangePos.amountOld = body.amountOld; profileChangePos.amountOld = body.amountOld;
profileChangePos.reason = body.reason? String(body.reason) : ""; profileChangePos.reason = body.reason? String(body.reason) : "";
profileChangePos.dateCurrent = body.dateCurrent; profileChangePos.dateCurrent = body.dateCurrent;

View file

@ -1,6 +1,7 @@
import { Entity, Column, OneToMany } from "typeorm"; import { Entity, Column, OneToMany, OneToOne } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { AuthRoleAttr } from "./AuthRoleAttr"; import { AuthRoleAttr } from "./AuthRoleAttr";
import { PosMaster } from "./PosMaster";
@Entity("authRole") @Entity("authRole")
export class AuthRole extends EntityBase { export class AuthRole extends EntityBase {
@ -22,6 +23,9 @@ export class AuthRole extends EntityBase {
@OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForRole) @OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForRole)
authRoles: AuthRoleAttr[]; authRoles: AuthRoleAttr[];
@OneToOne(() => PosMaster, (posMaster) => posMaster.authRole)
posMaster: PosMaster;
} }
export class CreateAuthRole { export class CreateAuthRole {

View file

@ -9,6 +9,7 @@ import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3"; import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4"; import { OrgChild4 } from "./OrgChild4";
import { Profile } from "./Profile"; import { Profile } from "./Profile";
import { AuthRole } from "./AuthRole";
enum PosMasterLine { enum PosMasterLine {
MAIN = "MAIN", MAIN = "MAIN",
@ -170,6 +171,16 @@ export class PosMaster extends EntityBase {
}) })
orgRevisionId: string; //fk 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) @ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.posMasters)
@JoinColumn({ name: "orgRevisionId" }) @JoinColumn({ name: "orgRevisionId" })
orgRevision: OrgRevision; orgRevision: OrgRevision;

View file

@ -255,7 +255,7 @@ export type UpdateProfileChangePosition = {
posMasterNoOld: number; posMasterNoOld: number;
positionTypeOld: string; positionTypeOld: string;
positionLevelOld: string; positionLevelOld: string;
positionNumberOld: string; organizationPositionOld: string;
amountOld: number; amountOld: number;
dateCurrent : Date; dateCurrent : Date;
reason: string | null; reason: string | null;