Untitled

 avatar
user_9551115
typescript
a month ago
2.0 kB
1
Indexable
interface ILeave extends Model<Document> {
  employee: Schema.Types.ObjectId;  // Employee ID (Object ID)
  leaveType: "Paid" | "Unpaid" | "Casual"; // Leave type
  kind: "Hourly" | "DateRange" | "HalfDay"; // Leave Kind
  requestedDate: Date; // Requested date (The day when the application is submitted)
  startDate: Date; // Start date (If kind is hourly or half day then the start date will be the same as the end date, otherwise the start date will be the leave start date)
  endDate: Date;// End date (If kind is hourly or half day then the end date will be the same as the start date, otherwise it will be value of the end date of the leave)
  hours: string; // Hours value (If kind is hourly the value representation will be 11:10am-02:30pm and if the kind is half day then the range will be the same representation in 4hrs difference)
  reason: string; // Reason for leave
  leaveDate: Date; // Leave date (If kind is hourly or half day then the leave date will be the same as the start date and end date, otherwise it will be the leave date)
  status: "Pending" | "Approved" | "Rejected"; // Status of the leave
  comments: string; // Comments on leave from the hr
  leaveHours: number; // Leave hours in number representation (If kind is hourly or half day) eg: 1.5 for 1hr and 30 min leave
  leaveDays: number; // Leave days in number representation (If kind is DateRange) The value will be the difference between the start and end date of the leave) eg: 4 for 4 days leave
  approvalDate: Date; // Approval date (If the status is either approved or rejected)
  approvedBy: Schema.Types.ObjectId; // Approved by (The id of the hr-admin, If the status is approved)
  rejectionReason: string; // Rejection reason (If the status is rejected) Optional
  employeeLeaveQuota: Schema.Types.ObjectId; // Leave quota will be populated automatically no need to provide from user end.
  month: String; // Month of the leave. eg: January
  year: Number; // Year of the leave. eg: 2025
}
Leave a Comment