checkpoint

This commit is contained in:
AdisakKanthawilang 2024-01-25 14:35:19 +07:00
parent 42bd8cd77b
commit 5fbb2c5eea
4 changed files with 261 additions and 39 deletions

View file

@ -100,20 +100,49 @@ export class OrgChild2 extends EntityBase {
})
orgChild1Id: string;
// @ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild2s)
// @JoinColumn({ name: "orgRootId" })
// orgRoot: OrgRoot;
@ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild2s)
@JoinColumn({ name: "orgChild1Id" })
orgChild1: OrgChild1;
//child table 3,4
@OneToMany(() => OrgChild3, orgChild3 => orgChild3.orgChild2)
orgChild3s: OrgChild3[];
// @OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgChild2)
// orgChild4s: OrgChild4[];
}
export class CreateOrgChild2 {
@Column()
orgChild2Name: string;
@Column()
orgChild2ShortName: string;
@Column()
orgChild2Code: string;
@Column()
orgChild2Rank: string;
@Column()
orgChild2Order: number;
@Column()
orgChild2PhoneEx: string;
@Column()
orgChild2PhoneIn: string;
@Column()
orgChild2Fax: string;
@Column()
orgChild2IsNormal: boolean;
@Column('uuid')
orgRootId: string;
@Column('uuid')
orgChild1Id: string;
}
export type UpdateOrgChild2 = Partial<OrgChild2>;

View file

@ -1,27 +1,17 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
// ENUM orgRootRank
enum OrgRootRank {
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
}
@Entity("orgRoot")
export class OrgRoot extends EntityBase {
// @Column({
// comment: "",
// length: 40,
// default: "00000000-0000-0000-0000-000000000000",
// })
// orgRootId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
@ -85,35 +75,23 @@ export class OrgRoot extends EntityBase {
@Column({
nullable: true,
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
default: true
default: true,
})
orgRootIsNormal: boolean;
@Column({
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
orgRevisionId: string;
//child table 1,2,3,4
@OneToMany(() => OrgChild1, orgChild1 => orgChild1.orgRoot)
@OneToMany(() => OrgChild1, (orgChild1) => orgChild1.orgRoot)
orgChild1s: OrgChild1[];
// @OneToMany(() => OrgChild2, orgChild2 => orgChild2.orgRoot)
// orgChild2s: OrgChild2[];
// @OneToMany(() => OrgChild3, orgChild3 => orgChild3.orgRoot)
// orgChild3s: OrgChild3[];
// @OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgRoot)
// orgChild4s: OrgChild4[];
}
export type UpdateOrgRoot = Partial<OrgRoot>;
export class CreateOrgRoot {
@Column()
orgRootName: string;
@ -140,5 +118,4 @@ export class CreateOrgRoot {
@Column()
orgRootIsNormal: boolean;
}