This commit is contained in:
Narul Hidayah
2026-02-02 20:02:59 +07:00
parent 44d039b4e9
commit baca5ff758
3 changed files with 74 additions and 1 deletions

View File

@ -24,8 +24,9 @@ export class HrmsAttendance {
})
date_at: Date;
/** Nullable when record created from break punch only (no clock in) */
@Column({
nullable: false,
nullable: true,
})
in_at: Date;

View File

@ -0,0 +1,71 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { HrmsEmployee } from "./hrms_employee";
export type AttendanceRequestStatus = "PENDING" | "APPROVED" | "REJECTED";
/** Type of punch being requested: maps to attendance column on approve */
export type AttendanceRequestType = "in" | "break_out" | "break_in" | "out";
@Entity("hrms_attendance_requests", { schema: "hrms" })
export class HrmsAttendanceRequest {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => HrmsEmployee, { onDelete: "RESTRICT", nullable: false })
@JoinColumn()
employee: HrmsEmployee;
/** Type of punch: in → in_at, break_out → break_out_at, break_in → break_in_at, out → out_at */
@Column({ length: 32, nullable: false })
type: AttendanceRequestType;
@Column({ type: "date", nullable: false })
date_at: Date;
/** Requested time for this punch (used for the column indicated by type) */
@Column({ type: "timestamp", nullable: false })
requested_at: Date;
/** Employee reason on submit; supervisor can set when rejecting */
@Column({ type: "text", nullable: true })
remark: string;
@Column({ length: 32, nullable: false, default: "PENDING" })
status: AttendanceRequestStatus;
@ManyToOne(() => HrmsEmployee, { onDelete: "SET NULL", nullable: true })
@JoinColumn()
approved_by: HrmsEmployee;
@Column({ type: "timestamp", nullable: true })
approved_at: Date;
@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;
}

View File

@ -10,6 +10,7 @@ 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_attendance_request";
export * from "../entity/hrms/hrms_payroll";
export * from "../entity/hrms/hrms_payroll_monthly";
export * from "../entity/hrms/hrms_leave";