Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
551d2d70a4
4 changed files with 65 additions and 1 deletions
|
|
@ -3,6 +3,9 @@ import { EntityBase } from "./base/Base";
|
|||
import { PosType } from "./PosType";
|
||||
import { Position } from "./Position";
|
||||
import { PosDict } from "./PosDict";
|
||||
import { Profile } from "./Profile";
|
||||
import { profile } from "console";
|
||||
|
||||
enum PosLevelAuthority {
|
||||
HEAD = "HEAD",
|
||||
DEPUTY = "DEPUTY",
|
||||
|
|
@ -50,6 +53,9 @@ export class PosLevel extends EntityBase {
|
|||
|
||||
@OneToMany(() => PosDict, (posDict) => posDict.posLevel)
|
||||
posDicts: PosDict[];
|
||||
|
||||
@OneToMany(() => Profile, (profile) => profile.posLevelsId)
|
||||
posLevelId: Profile;
|
||||
}
|
||||
|
||||
export class CreatePosLevel {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { EntityBase } from "./base/Base";
|
|||
import { PosLevel } from "./PosLevel";
|
||||
import { Position } from "./Position";
|
||||
import { PosDict } from "./PosDict";
|
||||
import { Profile } from "./Profile";
|
||||
|
||||
@Entity("posType")
|
||||
export class PosType extends EntityBase {
|
||||
|
|
@ -30,6 +31,9 @@ export class PosType extends EntityBase {
|
|||
|
||||
@OneToMany(() => PosDict, (posDict) => posDict.posType)
|
||||
posDicts: PosDict[];
|
||||
|
||||
@OneToMany(() => Profile, (profile) => profile.posTypesId)
|
||||
posTypeId: Profile;
|
||||
}
|
||||
|
||||
export class CreatePosType {
|
||||
|
|
|
|||
|
|
@ -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 { PosMaster } from "./PosMaster";
|
||||
import { PosLevel } from "./PosLevel";
|
||||
import { PosType } from "./PosType";
|
||||
|
||||
@Entity("profile")
|
||||
export class Profile extends EntityBase {
|
||||
|
|
@ -36,6 +38,28 @@ export class Profile extends EntityBase {
|
|||
})
|
||||
citizenId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่ง",
|
||||
default: null,
|
||||
length: 255,
|
||||
})
|
||||
position: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "ไอดีระดับตำแหน่ง",
|
||||
})
|
||||
posLevelId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "ไอดีประเภทตำแหน่",
|
||||
})
|
||||
posTypeId: string;
|
||||
|
||||
// @Column({
|
||||
// nullable: true,
|
||||
// length: 40,
|
||||
|
|
@ -61,6 +85,14 @@ export class Profile extends EntityBase {
|
|||
|
||||
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileAddType11707279774838 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileAddType11707279774838'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`posLevelId\` varchar(40) NULL COMMENT 'ไอดีระดับตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`posTypeId\` varchar(40) NULL COMMENT 'ไอดีประเภทตำแหน่'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_9098aae6d26e1d5a274f90240ff\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_de774e32853add3313ff44bd793\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_de774e32853add3313ff44bd793\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_9098aae6d26e1d5a274f90240ff\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`posTypeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`posLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`position\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue