Migration ฟิลด์ตาราง profileLeave, profileLeaveHistory & สร้างตาราง profileAbsentLate, profileEmployeeAbsentLate
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m52s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m52s
This commit is contained in:
parent
41ad2a44e8
commit
a76bda34b4
9 changed files with 706 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ import { ProfileAssistance } from "./ProfileAssistance";
|
|||
import { ProfileSalaryTemp } from "./ProfileSalaryTemp";
|
||||
import { PositionSalaryEditHistory } from "./PositionSalaryEditHistory";
|
||||
import { ProfileChangeName } from "./ProfileChangeName";
|
||||
import { ProfileAbsentLate } from "./ProfileAbsentLate";
|
||||
|
||||
@Entity("profile")
|
||||
export class Profile extends EntityBase {
|
||||
|
|
@ -546,6 +547,9 @@ export class Profile extends EntityBase {
|
|||
@OneToMany(() => ProfileChangeName, (v) => v.profile)
|
||||
profileChangeNames: ProfileChangeName[];
|
||||
|
||||
@OneToMany(() => ProfileAbsentLate, (v) => v.profile)
|
||||
profileAbsentLates: ProfileAbsentLate[];
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel: PosLevel;
|
||||
|
|
|
|||
98
src/entities/ProfileAbsentLate.ts
Normal file
98
src/entities/ProfileAbsentLate.ts
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
|
||||
// Enums
|
||||
export enum AbsentLateStatus {
|
||||
LATE = "LATE", // มาสาย
|
||||
ABSENT = "ABSENT", // ขาดราชการ
|
||||
}
|
||||
|
||||
export enum StampType {
|
||||
FULL_DAY = "FULL_DAY", // เต็มวัน
|
||||
MORNING = "MORNING", // ครึ่งเช้า
|
||||
AFTERNOON = "AFTERNOON", // ครึ่งบ่าย
|
||||
}
|
||||
|
||||
@Entity("profileAbsentLate")
|
||||
export class ProfileAbsentLate extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: AbsentLateStatus,
|
||||
comment: "สถานะ มาสาย/ขาดราชการ",
|
||||
nullable: false,
|
||||
})
|
||||
status: AbsentLateStatus;
|
||||
|
||||
@Column({
|
||||
type: "datetime",
|
||||
comment: "วันที่และเวลาที่ลงเวลา",
|
||||
nullable: false,
|
||||
})
|
||||
stampDate: Date;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: StampType,
|
||||
comment: "เต็มวัน/ครึ่งเช้า/ครึ่งบ่าย",
|
||||
default: StampType.FULL_DAY,
|
||||
})
|
||||
stampType: StampType;
|
||||
|
||||
@Column({
|
||||
type: "decimal",
|
||||
precision: 2,
|
||||
scale: 1,
|
||||
comment: "จำนวน (1.0/0.5)",
|
||||
default: "1.0",
|
||||
})
|
||||
stampAmount: number;
|
||||
|
||||
@Column({
|
||||
type: "varchar",
|
||||
length: 250,
|
||||
comment: "หมายเหตุ",
|
||||
nullable: true,
|
||||
})
|
||||
remark: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะลบข้อมูล",
|
||||
default: false,
|
||||
})
|
||||
isDeleted: boolean;
|
||||
|
||||
@ManyToOne(() => Profile, (profile) => profile.profileAbsentLates)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
}
|
||||
|
||||
// DTO Classes
|
||||
export class CreateProfileAbsentLate {
|
||||
profileId: string;
|
||||
status: AbsentLateStatus;
|
||||
stampDate: Date;
|
||||
stampType?: StampType;
|
||||
stampAmount?: number;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export class CreateProfileAbsentLateBatch {
|
||||
records: CreateProfileAbsentLate[];
|
||||
}
|
||||
|
||||
export type UpdateProfileAbsentLate = {
|
||||
status?: AbsentLateStatus;
|
||||
stampDate?: Date;
|
||||
stampType?: StampType;
|
||||
stampAmount?: number;
|
||||
remark?: string;
|
||||
};
|
||||
|
|
@ -38,6 +38,7 @@ import { StateOperatorUser } from "./StateOperatorUser";
|
|||
import { EmployeeTempPosMaster } from "./EmployeeTempPosMaster";
|
||||
import { ProfileSalaryTemp } from "./ProfileSalaryTemp";
|
||||
import { PositionSalaryEditHistory } from "./PositionSalaryEditHistory";
|
||||
import { ProfileEmployeeAbsentLate } from "./ProfileEmployeeAbsentLate";
|
||||
|
||||
@Entity("profileEmployee")
|
||||
export class ProfileEmployee extends EntityBase {
|
||||
|
|
@ -827,6 +828,9 @@ export class ProfileEmployee extends EntityBase {
|
|||
@OneToMany(() => PositionSalaryEditHistory, (v) => v.profileEmployee)
|
||||
positionSalaryEditHistory: PositionSalaryEditHistory[];
|
||||
|
||||
@OneToMany(() => ProfileEmployeeAbsentLate, (v) => v.profileEmployee)
|
||||
profileEmployeeAbsentLates: ProfileEmployeeAbsentLate[];
|
||||
|
||||
//ที่อยู่
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
|
|||
87
src/entities/ProfileEmployeeAbsentLate.ts
Normal file
87
src/entities/ProfileEmployeeAbsentLate.ts
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { AbsentLateStatus, StampType } from "./ProfileAbsentLate";
|
||||
|
||||
@Entity("profileEmployeeAbsentLate")
|
||||
export class ProfileEmployeeAbsentLate extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: AbsentLateStatus,
|
||||
comment: "สถานะ มาสาย/ขาดราชการ",
|
||||
nullable: false,
|
||||
})
|
||||
status: AbsentLateStatus;
|
||||
|
||||
@Column({
|
||||
type: "datetime",
|
||||
comment: "วันที่และเวลาที่ลงเวลา",
|
||||
nullable: false,
|
||||
})
|
||||
stampDate: Date;
|
||||
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: StampType,
|
||||
comment: "เต็มวัน/ครึ่งเช้า/ครึ่งบ่าย",
|
||||
default: StampType.FULL_DAY,
|
||||
})
|
||||
stampType: StampType;
|
||||
|
||||
@Column({
|
||||
type: "decimal",
|
||||
precision: 2,
|
||||
scale: 1,
|
||||
comment: "จำนวน (1.0/0.5)",
|
||||
default: "1.0",
|
||||
})
|
||||
stampAmount: number;
|
||||
|
||||
@Column({
|
||||
type: "varchar",
|
||||
length: 250,
|
||||
comment: "หมายเหตุ",
|
||||
nullable: true,
|
||||
})
|
||||
remark: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะลบข้อมูล",
|
||||
default: false,
|
||||
})
|
||||
isDeleted: boolean;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.profileEmployeeAbsentLates)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
// DTO Classes
|
||||
export class CreateProfileEmployeeAbsentLate {
|
||||
profileEmployeeId: string;
|
||||
status: AbsentLateStatus;
|
||||
stampDate: Date;
|
||||
stampType?: StampType;
|
||||
stampAmount?: number;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export class CreateProfileEmployeeAbsentLateBatch {
|
||||
records: CreateProfileEmployeeAbsentLate[];
|
||||
}
|
||||
|
||||
export type UpdateProfileEmployeeAbsentLate = {
|
||||
status?: AbsentLateStatus;
|
||||
stampDate?: Date;
|
||||
stampType?: StampType;
|
||||
stampAmount?: number;
|
||||
remark?: string;
|
||||
};
|
||||
|
|
@ -107,6 +107,24 @@ export class ProfileLeave extends EntityBase {
|
|||
})
|
||||
isDeleted: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเภทย่อยการลา (เช่น ศึกษาต่อ, ฝึกอบรม, ปฎอบัติการวิจัย, ดูงาน)",
|
||||
type: "varchar",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
leaveSubTypeName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ประเทศที่ไป",
|
||||
type: "varchar",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
coupleDayLevelCountry: string;
|
||||
|
||||
@OneToMany(() => ProfileLeaveHistory, (v) => v.profileLeave)
|
||||
histories: ProfileLeaveHistory[];
|
||||
|
||||
|
|
@ -153,6 +171,8 @@ export class CreateProfileLeave {
|
|||
status?: string | null;
|
||||
reason: string | null;
|
||||
leaveId?: string | null;
|
||||
leaveSubTypeName?: string | null;
|
||||
coupleDayLevelCountry?: string | null;
|
||||
}
|
||||
|
||||
export class CreateProfileEmployeeLeave {
|
||||
|
|
@ -166,6 +186,8 @@ export class CreateProfileEmployeeLeave {
|
|||
status: string | null;
|
||||
reason: string | null;
|
||||
leaveId?: string | null;
|
||||
leaveSubTypeName?: string | null;
|
||||
coupleDayLevelCountry?: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileLeave = {
|
||||
|
|
@ -177,4 +199,6 @@ export type UpdateProfileLeave = {
|
|||
totalLeave?: number | null;
|
||||
status?: string | null;
|
||||
reason?: string | null;
|
||||
leaveSubTypeName?: string | null;
|
||||
coupleDayLevelCountry?: string | null;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue