This commit is contained in:
Rizki
2026-02-03 14:52:58 +07:00
7 changed files with 204 additions and 1 deletions

View File

@ -0,0 +1,24 @@
import { Entity, PrimaryColumn, ManyToOne, JoinColumn } from "typeorm";
import { HrmsEmployee } from "../hrms/hrms_employee";
/**
* Single-row config for CPV default signatories.
* Used when creating CPV to auto-fill: AUTORIZADOR DA AGENCIA, CERTIFICADO DA AGENCIA, AUTORIZADOR DO TESOURO.
*/
@Entity("finance_cpv_config", { schema: "finances" })
export class FinanceCpvConfig {
@PrimaryColumn({ length: 64, default: "default" })
id: string;
@ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
agency_authorizer: HrmsEmployee;
@ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
agency_certifier: HrmsEmployee;
@ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
treasury_authorizer: HrmsEmployee;
}

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;
@ -68,6 +69,46 @@ export class HrmsAttendance {
})
is_late: boolean;
/** Snapshot: batas awal clock in shift saat absen (agar tidak berubah jika shift diubah nanti) */
@Column({
type: "time",
nullable: true,
})
shift_in_start_time: string;
/** Snapshot: batas akhir clock in shift saat absen (agar tidak berubah jika shift diubah nanti) */
@Column({
type: "time",
nullable: true,
})
shift_in_end_time: string;
/** Snapshot: batas break out shift saat absen */
@Column({
type: "time",
nullable: true,
})
shift_break_out_start_time: string;
@Column({
type: "time",
nullable: true,
})
shift_break_out_end_time: string;
/** Snapshot: batas break in shift saat absen */
@Column({
type: "time",
nullable: true,
})
shift_break_in_start_time: string;
@Column({
type: "time",
nullable: true,
})
shift_break_in_end_time: string;
@Column({
nullable: false,
length: 64,

View File

@ -0,0 +1,76 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
OneToMany,
} from "typeorm";
import { HrmsEmployee } from "./hrms_employee";
import { HrmsAttendanceRequestApproval } from "./hrms_attendance_request_approval";
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;
@OneToMany(() => HrmsAttendanceRequestApproval, (approval) => approval.attendance_request, { cascade: true })
approvals: HrmsAttendanceRequestApproval[];
@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

@ -0,0 +1,53 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { HrmsAttendanceRequest } from "./hrms_attendance_request";
import { HrmsEmployee } from "./hrms_employee";
import { ApprovalType, ApprovalStatus } from "./hrms_leave_approval";
@Entity("hrms_attendance_request_approvals", { schema: "hrms" })
export class HrmsAttendanceRequestApproval {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => HrmsAttendanceRequest, { onDelete: "CASCADE", nullable: true })
@JoinColumn()
attendance_request: HrmsAttendanceRequest;
@Column({
type: "enum",
enum: ApprovalType,
nullable: false,
})
approval_type: ApprovalType;
@ManyToOne(() => HrmsEmployee, { onDelete: "RESTRICT", nullable: true })
@JoinColumn()
approver: HrmsEmployee;
@Column({
type: "enum",
enum: ApprovalStatus,
default: ApprovalStatus.PENDING,
nullable: false,
})
status: ApprovalStatus;
@Column({ type: "timestamp", nullable: true })
approved_at: Date;
@Column({ length: 512, nullable: true })
notes: string;
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn({ nullable: true })
updated_at: Date;
}

View File

@ -17,6 +17,12 @@ export class HrmsTrainingParticipant {
@JoinColumn()
employee: HrmsEmployee;
@Column({
nullable: true,
length: 512,
})
certificate_url: string;
@Column({
nullable: false,
length: 64,

View File

@ -12,6 +12,7 @@ export * from "../entity/finance/finance_plan_items";
export * from "../entity/finance/finance_purchase_requests";
export * from "../entity/finance/finance_purchase_request_items";
export * from "../entity/finance/finance_cpvs";
export * from "../entity/finance/finance_cpv_config";
export * from "../entity/finance/finance_checklist_payment";
export * from "../entity/finance/finance_checklist_payment_item";
export * from "../entity/finance/finance_checklist_payment_approval";

View File

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