upd
This commit is contained in:
@ -7,8 +7,10 @@ import {
|
||||
DeleteDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
OneToMany,
|
||||
} from "typeorm";
|
||||
import { HrmsEmployee } from "./hrms_employee";
|
||||
import { HrmsAttendanceRequestApproval } from "./hrms_attendance_request_approval";
|
||||
|
||||
export type AttendanceRequestStatus = "PENDING" | "APPROVED" | "REJECTED";
|
||||
|
||||
@ -42,6 +44,9 @@ export class HrmsAttendanceRequest {
|
||||
@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;
|
||||
|
||||
53
src/entity/hrms/hrms_attendance_request_approval.ts
Normal file
53
src/entity/hrms/hrms_attendance_request_approval.ts
Normal 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;
|
||||
}
|
||||
@ -11,6 +11,7 @@ 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";
|
||||
|
||||
Reference in New Issue
Block a user