เพิ่มlink relation

This commit is contained in:
Kittapath 2024-01-31 14:29:39 +07:00
parent a41e33c0d4
commit d74c3140fa
16 changed files with 416 additions and 139 deletions

View file

@ -1,5 +1,8 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosExecutive } from "./PosExecutive";
import { PosType } from "./PosType";
import { PosLevel } from "./PosLevel";
@Entity("posDict")
export class PosDict extends EntityBase {
@ -24,7 +27,6 @@ export class PosDict extends EntityBase {
comment: "ตำแหน่งประเภท",
default: "00000000-0000-0000-0000-000000000000",
})
posTypeId: string;
@Column({
@ -58,6 +60,17 @@ export class PosDict extends EntityBase {
})
posDictArea: string;
@ManyToOne(() => PosExecutive, (posExecutive) => posExecutive)
@JoinColumn({ name: "posExecutiveId" })
posExecutive: PosExecutive;
@ManyToOne(() => PosType, (posType) => posType)
@JoinColumn({ name: "posTypeId" })
posType: PosType;
@ManyToOne(() => PosLevel, (posLevel) => posLevel)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;
}
export class CreatePosDict {
@ -84,4 +97,3 @@ export class CreatePosDict {
}
export type UpdatePosDict = Partial<CreatePosDict>;