add fields

This commit is contained in:
Bright 2024-02-07 11:17:01 +07:00
parent 74507f2299
commit 086d766337
3 changed files with 42 additions and 1 deletions

View file

@ -3,6 +3,9 @@ import { EntityBase } from "./base/Base";
import { PosType } from "./PosType"; import { PosType } from "./PosType";
import { Position } from "./Position"; import { Position } from "./Position";
import { PosDict } from "./PosDict"; import { PosDict } from "./PosDict";
import { Profile } from "./Profile";
import { profile } from "console";
enum PosLevelAuthority { enum PosLevelAuthority {
HEAD = "HEAD", HEAD = "HEAD",
DEPUTY = "DEPUTY", DEPUTY = "DEPUTY",
@ -50,6 +53,9 @@ export class PosLevel extends EntityBase {
@OneToMany(() => PosDict, (posDict) => posDict.posLevel) @OneToMany(() => PosDict, (posDict) => posDict.posLevel)
posDicts: PosDict[]; posDicts: PosDict[];
@OneToMany(() => Profile, (profile) => profile.posLevelsId)
posLevelId: Profile;
} }
export class CreatePosLevel { export class CreatePosLevel {

View file

@ -3,6 +3,7 @@ import { EntityBase } from "./base/Base";
import { PosLevel } from "./PosLevel"; import { PosLevel } from "./PosLevel";
import { Position } from "./Position"; import { Position } from "./Position";
import { PosDict } from "./PosDict"; import { PosDict } from "./PosDict";
import { Profile } from "./Profile";
@Entity("posType") @Entity("posType")
export class PosType extends EntityBase { export class PosType extends EntityBase {
@ -30,6 +31,9 @@ export class PosType extends EntityBase {
@OneToMany(() => PosDict, (posDict) => posDict.posType) @OneToMany(() => PosDict, (posDict) => posDict.posType)
posDicts: PosDict[]; posDicts: PosDict[];
@OneToMany(() => Profile, (profile) => profile.posTypesId)
posTypeId: Profile;
} }
export class CreatePosType { export class CreatePosType {

View file

@ -1,6 +1,8 @@
import { Entity, Column, OneToMany, OneToOne, JoinColumn, ManyToMany } from "typeorm"; import { Entity, Column, OneToMany, OneToOne, JoinColumn, ManyToMany, ManyToOne } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster"; import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel";
import { PosType } from "./PosType";
@Entity("profile") @Entity("profile")
export class Profile extends EntityBase { export class Profile extends EntityBase {
@ -36,6 +38,26 @@ export class Profile extends EntityBase {
}) })
citizenId: string; citizenId: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
length: 255,
})
position: string;
@Column({
length: 40,
comment: "ไอดีระดับตำแหน่ง",
})
posLevelId: string;
@Column({
length: 40,
comment: "ไอดีประเภทตำแหน่",
})
posTypeId: string;
// @Column({ // @Column({
// nullable: true, // nullable: true,
// length: 40, // length: 40,
@ -61,6 +83,15 @@ export class Profile extends EntityBase {
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder) @OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
next_holders: PosMaster[]; next_holders: PosMaster[];
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevelId)
@JoinColumn({ name: "posLevelId" })
posLevelsId: PosLevel;
@ManyToOne(() => PosType, (posType) => posType.posTypeId)
@JoinColumn({ name: "posTypeId" })
posTypesId: PosType;
} }
export class CreateProfile { export class CreateProfile {