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
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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue