table sign

This commit is contained in:
kittapath 2024-11-01 17:21:57 +07:00
parent 322c2f3665
commit 0b2650e17c
4 changed files with 107 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import { CommandSalary } from "./CommandSalary";
import { CommandRecive } from "./CommandRecive";
import { ProfileSalary } from "./ProfileSalary";
import { ProfileSalaryHistory } from "./ProfileSalaryHistory";
import { CommandSign } from "./CommandSign";
@Entity("command")
export class Command extends EntityBase {
@ -151,6 +152,9 @@ export class Command extends EntityBase {
@OneToMany(() => CommandSend, (commandSend) => commandSend.command)
commandSends: CommandSend[];
@OneToMany(() => CommandSign, (commandSign) => commandSign.command)
commandSigns: CommandSign[];
@OneToMany(() => CommandRecive, (commandRecive) => commandRecive.command)
commandRecives: CommandRecive[];

View file

@ -0,0 +1,80 @@
import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Command } from "./Command";
import { Profile } from "./Profile";
@Entity("commandSign")
export class CommandSign extends EntityBase {
@Column({
nullable: true,
comment: "คำนำหน้า",
length: 255,
default: null,
})
prefix: string;
@Column({
nullable: true,
comment: "ชื่อ",
length: 255,
default: null,
})
firstName: 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,
})
comment: string;
@Column({
comment: "เป็นผู้มีอำนาจลงนาม",
default: false,
})
isActive: boolean;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
})
commandId: string;
@ManyToOne(() => Command, (command) => command.commandSigns)
@JoinColumn({ name: "commandId" })
command: Command;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
})
profileId: string;
@ManyToOne(() => Profile, (profile) => profile.commandSigns)
@JoinColumn({ name: "profileId" })
profile: Profile;
}
export class CreateCommandSign {
@Column()
name: string;
}
// export type UpdateCommandSign = Partial<CreateCommandSign>;

View file

@ -34,6 +34,7 @@ import { CommandSend } from "./CommandSend";
import { DevelopmentRequest } from "./DevelopmentRequest";
import { StateOperatorUser } from "./StateOperatorUser";
import { StateUserComment } from "./StateUserComment";
import { CommandSign } from "./CommandSign";
@Entity("profile")
export class Profile extends EntityBase {
@ -122,7 +123,7 @@ export class Profile extends EntityBase {
@Column({
nullable: true,
comment: "สถานะอีเมล",//VERIFIED = ยืนยัน, NOT_VERIFIED = ไม่ได้ยืนยัน
comment: "สถานะอีเมล", //VERIFIED = ยืนยัน, NOT_VERIFIED = ไม่ได้ยืนยัน
default: null,
})
statusEmail: string;
@ -387,6 +388,9 @@ export class Profile extends EntityBase {
@OneToMany(() => CommandSend, (v) => v.profile)
commandSends: CommandSend[];
@OneToMany(() => CommandSign, (v) => v.profile)
commandSigns: CommandSign[];
@OneToMany(() => StateOperatorUser, (v) => v.profile)
stateOperatorUsers: StateOperatorUser[];