diff --git a/src/entity/hrms/hrms_attendance.ts b/src/entity/hrms/hrms_attendance.ts new file mode 100644 index 0000000..7ff3309 --- /dev/null +++ b/src/entity/hrms/hrms_attendance.ts @@ -0,0 +1,75 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Status } from "../../types/status"; +import { HrmsEmployee } from "./hrms_employee"; +import { AttendanceType } from "../../types/hrms"; +import { HrmsShift } from "./hrms_shift"; + +@Entity("hrms_attendances", { schema: "hrms" }) +export class HrmsAttendance { + @PrimaryGeneratedColumn("uuid") + id: string; + + @ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: false }) + @JoinColumn() + employee: HrmsEmployee; + + @Column({ + nullable: false, + length: 64, + }) + type: AttendanceType; + + @Column({ + nullable: false, + }) + date_at: Date; + + @Column({ + nullable: false, + }) + in_at: Date; + + @Column({ + nullable: false, + }) + out_at: Date; + + @Column({ + nullable: true, + type: "float8", + }) + duration: number; + + @Column({ + nullable: false, + default: false, + }) + is_late: boolean; + + @Column({ + nullable: false, + length: 64, + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/schema/hrms.ts b/src/schema/hrms.ts index 13d4b1b..a6978e4 100644 --- a/src/schema/hrms.ts +++ b/src/schema/hrms.ts @@ -9,6 +9,7 @@ export * from "../entity/hrms/hrms_scholarship"; export * from "../entity/hrms/hrms_training"; export * from "../entity/hrms/hrms_training_participant"; export * from "../entity/hrms/hrms_bank"; +export * from "../entity/hrms/hrms_attendance"; export * from "../entity/hrms/hrms_payroll"; export * from "../entity/hrms/hrms_payroll_monthly"; export * from "../entity/hrms/hrms_leave"; diff --git a/src/types/hrms.ts b/src/types/hrms.ts index e1bbf11..9c91eb8 100644 --- a/src/types/hrms.ts +++ b/src/types/hrms.ts @@ -1,20 +1,25 @@ export enum HolidayType { - NATIONAL = "NH", // National Holiday - COLLECTIVE = "CL", // Collective Leave / Cuti Bersama - COMPANY = "CH", // Company Holiday - RELIGIOUS = "RH", // Religious Holiday - SPECIAL = "SH", // Special / Exceptional Holiday + NATIONAL = "NH", // National Holiday + COLLECTIVE = "CL", // Collective Leave / Cuti Bersama + COMPANY = "CH", // Company Holiday + RELIGIOUS = "RH", // Religious Holiday + SPECIAL = "SH", // Special / Exceptional Holiday } export const HolidayTypeLabel: Record = { - [HolidayType.NATIONAL]: "National Holiday", - [HolidayType.COLLECTIVE]: "Collective Leave", - [HolidayType.COMPANY]: "Company Holiday", - [HolidayType.RELIGIOUS]: "Religious Holiday", - [HolidayType.SPECIAL]: "Special Holiday", + [HolidayType.NATIONAL]: "National Holiday", + [HolidayType.COLLECTIVE]: "Collective Leave", + [HolidayType.COMPANY]: "Company Holiday", + [HolidayType.RELIGIOUS]: "Religious Holiday", + [HolidayType.SPECIAL]: "Special Holiday", }; export enum YesNo { - YES = "Y", - NO = "N", + YES = "Y", + NO = "N", +} + +export enum AttendanceType { + IN = "in", + OUT = "out", }