Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
Kittapath 2024-02-06 15:44:16 +07:00
commit 08f2c8753e
10 changed files with 265 additions and 85 deletions

View file

@ -1,4 +1,4 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { CreatePosDict } from "./PosDict";
import { OrgRevision } from "./OrgRevision";
@ -127,7 +127,7 @@ export class PosMaster extends EntityBase {
"คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้",
default: null,
})
profileIdCurrentHolder: string;
current_holderId: string;
@Column({
nullable: true,
@ -136,7 +136,7 @@ export class PosMaster extends EntityBase {
"คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย",
default: null,
})
profileIdNextHolder: string;
next_holderId: string;
@Column({
length: 40,
@ -168,13 +168,13 @@ export class PosMaster extends EntityBase {
@JoinColumn({ name: "orgChild4Id" })
orgChild4: OrgChild4;
@OneToOne(() => Profile)
@JoinColumn()
current_holder: Profile;
@ManyToOne(() => PosMaster, (posMaster) => posMaster.current_holder)
@JoinColumn({ name: "current_holderId" })
current_holder: Profile[];
@OneToOne(() => Profile)
@JoinColumn()
next_holder: Profile;
@ManyToOne(() => PosMaster, (posMaster) => posMaster.next_holder)
@JoinColumn({ name: "next_holderId" })
next_holder: Profile[];
@OneToMany(() => Position, (position) => position.posMaster)
positions: Position[];

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, OneToOne, JoinColumn} from "typeorm";
import { Entity, Column, OneToMany, OneToOne, JoinColumn, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster";
@ -32,17 +32,34 @@ export class Profile extends EntityBase {
nullable: true,
comment: "เลขประจำตัวประชาชน",
default: null,
length: 13
length: 13,
})
citizenId: string;
@OneToOne(() => PosMaster)
@JoinColumn()
current_holder: PosMaster;
// @Column({
// nullable: true,
// length: 40,
// comment:
// "คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้",
// default: null,
// unique: false,
// })
// current_holderId: string;
@OneToOne(() => PosMaster)
@JoinColumn()
next_holder: PosMaster;
// @Column({
// nullable: true,
// length: 40,
// comment:
// "คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย",
// default: null,
// unique: false,
// })
// next_holderId: string;
@OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder)
current_holders: PosMaster[];
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
next_holders: PosMaster[];
}
export class CreateProfile {
@ -59,6 +76,4 @@ export class CreateProfile {
citizenId: string;
}
export type UpdateProfile = Partial<CreateProfile>;