เพิ่มตำแหน่งเจ้าหน้าที่

This commit is contained in:
kittapath 2024-09-12 22:53:58 +07:00
parent 3b0d8c24a7
commit 6f11eecb8f
15 changed files with 771 additions and 33 deletions

View file

@ -1,6 +1,7 @@
import { Entity, Column, JoinColumn, ManyToOne } from "typeorm";
import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { CommandType } from "./CommandType";
import { CommandSend } from "./CommandSend";
@Entity("command")
export class Command extends EntityBase {
@ -89,6 +90,9 @@ export class Command extends EntityBase {
@ManyToOne(() => CommandType, (commandType) => commandType.commands)
@JoinColumn({ name: "commandTypeId" })
commandType: CommandType;
@OneToMany(() => CommandSend, (commandSend) => commandSend.command)
commandSends: CommandSend[];
}
export class CreateCommand {

View file

@ -0,0 +1,92 @@
import { Entity, Column, JoinColumn, ManyToOne } from "typeorm";
import { EntityBase } from "./base/Base";
import { Command } from "./Command";
import { Profile } from "./Profile";
@Entity("commandSend")
export class CommandSend extends EntityBase {
// EMAIL = อีเมล
// INBOX = กล่องข้อความ
@Column({
nullable: true,
comment: "ช่องทางการส่งสำเนา",
length: 20,
default: null,
})
sendCC: string;
@Column({
nullable: true,
comment: "เลขประจำตัวประชาชน",
length: 255,
default: null,
})
citizenId: string;
@Column({
nullable: true,
comment: "คำนำหน้า",
length: 255,
default: null,
})
prefix: string;
@Column({
nullable: true,
comment: "ชื่อ",
length: 255,
default: null,
})
fristName: string;
@Column({
nullable: true,
comment: "สกุล",
length: 255,
default: null,
})
lastName: string;
@Column({
nullable: true,
comment: "ตำแหน่ง",
length: 255,
default: null,
})
position: string;
@Column({
nullable: true,
comment: "หน่วยงาน",
length: 255,
default: null,
})
org: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
})
commandId: string;
@ManyToOne(() => Command, (command) => command.commandSends)
@JoinColumn({ name: "commandId" })
command: Command;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
})
profileId: string;
@ManyToOne(() => Profile, (profile) => profile.commandSends)
@JoinColumn({ name: "profileId" })
profile: Profile;
}
export class CreateCommandSend {
@Column()
name: string;
}
// export type UpdateCommandSend = Partial<CreateCommandSend>;

View file

@ -0,0 +1,82 @@
import {
Entity,
Column,
CreateDateColumn,
UpdateDateColumn,
PrimaryColumn,
OneToMany,
} from "typeorm";
import { CommandType } from "./CommandType";
@Entity("commandSys")
export class CommandSys {
@PrimaryColumn({
comment: "ไอดีหลักของตาราง",
length: 255,
})
id: string;
@CreateDateColumn({ comment: "สร้างข้อมูลเมื่อ" })
createdAt!: Date;
@Column({
comment: "User Id ที่สร้างข้อมูล",
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
createdUserId!: String;
@UpdateDateColumn({ comment: "แก้ไขข้อมูลล่าสุดเมื่อ" })
lastUpdatedAt!: Date;
@Column({
comment: "User Id ที่แก้ไขข้อมูล",
length: 40,
default: "00000000-0000-0000-0000-000000000000",
})
lastUpdateUserId!: String;
@Column({ comment: "ชื่อ User ที่สร้างข้อมูล", length: 200, default: "string" })
createdFullName!: String;
@Column({ comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด", length: 200, default: "string" })
lastUpdateFullName!: String;
@Column({
nullable: true,
comment: "ชื่อระบบ",
length: 255,
default: null,
})
sysName: string;
@Column({
nullable: true,
comment: "รายละเอียด",
length: 255,
default: null,
})
sysDescription: string;
@OneToMany(() => CommandType, (commandType) => commandType.commandTypeSys)
commandTypes: CommandType[];
}
export class CreateCommandSys {
@PrimaryColumn()
id: string;
@Column()
sysName: string;
@Column()
sysDescription: string;
}
export class UpdateCommandSys {
@Column()
sysName: string;
@Column()
sysDescription: string;
}

View file

@ -1,6 +1,7 @@
import { Entity, Column, OneToMany } from "typeorm";
import { Entity, Column, OneToMany, JoinColumn, ManyToOne } from "typeorm";
import { EntityBase } from "./base/Base";
import { Command } from "./Command";
import { CommandSys } from "./CommandSys";
@Entity("commandType")
export class CommandType extends EntityBase {
@ -12,14 +13,6 @@ export class CommandType extends EntityBase {
})
name: string;
@Column({
nullable: true,
comment: "ประเภทคำสั่ง",
length: 255,
default: null,
})
type: string;
@Column({
nullable: true,
comment: "รหัสคำสั่ง",
@ -60,6 +53,18 @@ export class CommandType extends EntityBase {
@OneToMany(() => Command, (command) => command.commandType)
commands: Command[];
@Column({
nullable: true,
length: 255,
comment: "คีย์นอก(FK)ของตาราง CommandSys",
default: null,
})
commandSysId: string;
@ManyToOne(() => CommandSys, (commandSys) => commandSys.commandTypes)
@JoinColumn({ name: "commandSysId" })
commandTypeSys: CommandSys;
}
export class CreateCommandType {
@ -67,10 +72,10 @@ export class CreateCommandType {
name: string;
@Column()
type: string;
isActive: boolean;
@Column()
isActive: boolean;
commandSysId: string;
}
export type UpdateCommandType = Partial<CreateCommandType>;

View file

@ -97,8 +97,22 @@ export class EmployeePosMaster extends EntityBase {
comment: "เป็นเจ้าหน้าที่",
default: false,
})
isStaff: boolean;
@Column({
comment: "เป็นสกจ",
default: false,
})
isOfficer: boolean;
@Column({
nullable: true,
comment: "ตำแหน่งใต้ลายเซ็นต์",
type: "text",
default: null,
})
positionSign: string;
@Column({
nullable: true,
comment: "หมายเหตุ",
@ -253,8 +267,14 @@ export class CreateEmployeePosMaster {
@Column()
isDirector: boolean;
@Column()
isStaff: boolean;
@Column()
isOfficer: boolean;
@Column()
positionSign: string | null;
}
export type UpdateEmployeePosMaster = Partial<EmployeePosMaster>;

View file

@ -98,8 +98,22 @@ export class PosMaster extends EntityBase {
comment: "เป็นเจ้าหน้าที่",
default: false,
})
isStaff: boolean;
@Column({
comment: "เป็นสกจ",
default: false,
})
isOfficer: boolean;
@Column({
nullable: true,
comment: "ตำแหน่งใต้ลายเซ็นต์",
type: "text",
default: null,
})
positionSign: string;
@Column({
nullable: true,
comment: "หมายเหตุ",
@ -260,8 +274,14 @@ export class CreatePosMaster {
@Column()
isDirector: boolean;
@Column()
isStaff: boolean;
@Column()
isOfficer: boolean;
@Column()
positionSign: string | null;
}
export type UpdatePosMaster = Partial<PosMaster>;

View file

@ -31,6 +31,7 @@ import { ProfileEdit } from "./ProfileEdit";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { OrgRoot } from "./OrgRoot";
import { PermissionOrg } from "./PermissionOrg";
import { CommandSend } from "./CommandSend";
@Entity("profile")
export class Profile extends EntityBase {
@ -371,6 +372,9 @@ export class Profile extends EntityBase {
@OneToMany(() => ProfileFamilyCouple, (v) => v.profile)
profileFamilyCouple: ProfileFamilyCouple[];
@OneToMany(() => CommandSend, (v) => v.profile)
commandSends: CommandSend[];
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;