Leave Management
Leave Types
| Type | Code | Applies To |
|---|---|---|
| Sick Leave | SICK | Students, Employees |
| Casual Leave | CASUAL | Employees |
| Earned Leave | EARNED | Employees |
| Study Leave | STUDY | Employees |
| Maternity Leave | MATERNITY | Employees |
| On Duty | OD | Employees |
| Out of Station | OOS | Employees |
Student Leave Application
POST /parent/leave/apply
{
"data": {
"studentId": "uuid",
"fromDate": "2024-04-10",
"toDate": "2024-04-12",
"reason": "Family wedding",
"type": "SICK"
}
}
Teacher or school admin approves/rejects:
POST /teacher/leave/approve
{
"data": {
"leaveId": "uuid",
"status": "APPROVED", // APPROVED | REJECTED
"comment": "Approved. Please submit medical certificate on return."
}
}
Employee Leave Application
POST /teacher/leave/apply # (also used by school-admin for own leaves)
{
"data": {
"fromDate": "2024-04-15",
"toDate": "2024-04-17",
"reason": "Personal work",
"type": "CASUAL",
"halfDay": false,
"leaveCategory": "EMPLOYEE"
}
}
Approved by school admin or reporting manager:
POST /school-admin/leave/approve
Leave Balance
// Employee leave balance per year
{
"employeeId": "uuid",
"academicYear": "2024-25",
"balances": {
"CASUAL": { "total": 12, "used": 3, "pending": 1, "available": 8 },
"EARNED": { "total": 20, "used": 5, "pending": 0, "available": 15 },
"SICK": { "total": 10, "used": 2, "pending": 0, "available": 8 }
}
}
Leave balance is auto-updated on approval. Pending leaves are deducted from available but shown separately.
Attendance Integration
On APPROVED leave, the system automatically marks attendance as LEAVE for the leave period:
// LeaveService
async approveLeave(leaveId: string) {
const leave = await this.repo.findById(leaveId);
const dates = getDateRange(leave.fromDate, leave.toDate);
await Promise.all(dates.map(date =>
this.attendanceService.markLeave({
studentId: leave.studentId,
employeeId: leave.employeeId,
date,
markedBy: leave.approvedBy,
})
));
}
Leave Calendar
GET /school-admin/leave/calendar?month=2024-04&type=STUDENT
Shows all approved leaves for a given month as a calendar overlay.