From af7a31fd56a3bcd944a62d3b8ef4c635ec244235 Mon Sep 17 00:00:00 2001 From: Narul Hidayah Date: Wed, 31 Dec 2025 11:23:15 +0700 Subject: [PATCH] leave type, shift module --- src/entity/hrms/hrms_holiday.ts | 2 +- src/entity/hrms/hrms_leave_type.ts | 61 ++++++++++++++++++++++ src/entity/hrms/hrms_shift.ts | 70 ++++++++++++++++++++++++++ src/schema/hrms.ts | 4 +- src/types/{hrms_holiday.ts => hrms.ts} | 7 ++- 5 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 src/entity/hrms/hrms_leave_type.ts create mode 100644 src/entity/hrms/hrms_shift.ts rename src/types/{hrms_holiday.ts => hrms.ts} (91%) diff --git a/src/entity/hrms/hrms_holiday.ts b/src/entity/hrms/hrms_holiday.ts index 22b227a..25328ab 100644 --- a/src/entity/hrms/hrms_holiday.ts +++ b/src/entity/hrms/hrms_holiday.ts @@ -7,7 +7,7 @@ import { DeleteDateColumn } from "typeorm"; import { Status } from "../../types/status"; -import { HolidayType } from "../../types/hrms_holiday"; +import { HolidayType } from "../../types/hrms"; @Entity("hrms_holidays", { schema: "hrms" }) export class HrmsHoliday { diff --git a/src/entity/hrms/hrms_leave_type.ts b/src/entity/hrms/hrms_leave_type.ts new file mode 100644 index 0000000..43c2bd5 --- /dev/null +++ b/src/entity/hrms/hrms_leave_type.ts @@ -0,0 +1,61 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, +} from "typeorm"; +import { Status } from "../../types/status"; +import { YesNo } from "../../types/hrms"; + +@Entity("hrms_leave_types", { schema: "hrms" }) +export class HrmsLeaveType { + + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ length: 128 }) + name: string; + + @Column({ nullable: true, length: 256 }) + description: string; + + @Column({ type: "int" }) + maximum_days: number; + + @Column({ + type: "enum", + enum: YesNo, + default: YesNo.NO, + }) + deduct_quota: YesNo; + + @Column({ + type: "enum", + enum: YesNo, + default: YesNo.YES, + }) + paid: YesNo; + + @Column({ length: 64 }) + status: Status; + + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @UpdateDateColumn({ nullable: true }) + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @DeleteDateColumn({ nullable: true }) + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/entity/hrms/hrms_shift.ts b/src/entity/hrms/hrms_shift.ts new file mode 100644 index 0000000..3537205 --- /dev/null +++ b/src/entity/hrms/hrms_shift.ts @@ -0,0 +1,70 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn, +} from "typeorm"; +import { Status } from "../../types/status"; + +@Entity("hrms_shifts", { schema: "hrms" }) +export class HrmsShift { + + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + length: 128, + nullable: false, + }) + name: string; + + @Column({ + type: "time", + nullable: false, + }) + in_start_time: string; // HH:mm:ss + + @Column({ + type: "time", + nullable: false, + }) + in_end_time: string; + + @Column({ + type: "time", + nullable: false, + }) + out_start_time: string; + + @Column({ + type: "time", + nullable: false, + }) + out_end_time: string; + + @Column({ + length: 64, + nullable: false, + }) + status: Status; + + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @UpdateDateColumn({ nullable: true }) + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @DeleteDateColumn({ nullable: true }) + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/schema/hrms.ts b/src/schema/hrms.ts index d5bed62..7d994c5 100644 --- a/src/schema/hrms.ts +++ b/src/schema/hrms.ts @@ -2,5 +2,7 @@ export * from "../entity/hrms/hrms_department" export * from "../entity/hrms/hrms_airport" export * from "../entity/hrms/hrms_position" export * from "../entity/hrms/hrms_holiday" +export * from "../entity/hrms/hrms_leave_type" +export * from "../entity/hrms/hrms_shift" -export * from "../types/hrms_holiday" \ No newline at end of file +export * from "../types/hrms" \ No newline at end of file diff --git a/src/types/hrms_holiday.ts b/src/types/hrms.ts similarity index 91% rename from src/types/hrms_holiday.ts rename to src/types/hrms.ts index 0a63f2a..e1bbf11 100644 --- a/src/types/hrms_holiday.ts +++ b/src/types/hrms.ts @@ -12,4 +12,9 @@ export const HolidayTypeLabel: Record = { [HolidayType.COMPANY]: "Company Holiday", [HolidayType.RELIGIOUS]: "Religious Holiday", [HolidayType.SPECIAL]: "Special Holiday", -}; \ No newline at end of file +}; + +export enum YesNo { + YES = "Y", + NO = "N", +}