LeaveRequest
The LeaveRequest entity, mapped to the leave_request table.
| Table | leave_request |
| Tenant-scoped | Yes — extends TenantOwned |
| Columns | 8 |
| Relationships | 3 |
| Source | backend/src/main/java/com/motorph/payroll/model/LeaveRequest.java |
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
leaveRequestId | Integer | leave_request_id | — | primary key, generated |
dateRequested | LocalDate | date_requested | — | — |
startDate | LocalDate | start_date | Yes | — |
endDate | LocalDate | end_date | Yes | — |
status | String | status | — | — |
adminApprovalDate | LocalDateTime | admin_approval_date | Yes | — |
description | String | description | — | — |
isPaid | Boolean | is_paid | — | — |
Plus tenant_id, inherited from TenantOwned. Hibernate stamps it on insert and adds where tenant_id = ? to every query, so it is never written or read by application code.
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
employee | @ManyToOne | Employee | employee_id | Yes |
leaveType | @ManyToOne | LeaveRequestType | leave_type_id | Yes |
approver | @ManyToOne | Employee | admin_approval_employee_id | — |
Neighbourhood
Repository
LeaveRequestRepository
Declared over LeaveRequest with id type Integer, with JpaSpecificationExecutor for dynamic filtering. Source: backend/src/main/java/com/motorph/payroll/repository/LeaveRequestRepository.java
| Method | Returns | Notes |
|---|---|---|
findWithDetailsByLeaveRequestId(Integer leaveRequestId) | Optional<LeaveRequest> | derived |
findAllByEmployee_EmployeeNumberOrderByDateRequestedDesc(Integer employeeId) | List<LeaveRequest> | derived |
findAllByEmployee_EmployeeNumberAndStatusIn(Integer employeeId, Collection<String> statuses) | List<LeaveRequest> | derived |
findApprovedOverlapping(@Param("employeeNumber") Integer employeeNumber, @Param("periodStart") LocalDate periodStart, @Param("periodEnd") LocalDate periodEnd) | List<LeaveRequest> | explicit @Query |
Reached by
These controllers hold — directly or through a service they depend on — a repository over LeaveRequest.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| DemoDataController | /api/system-admin/demo-data | 3 | Billing & Platform |
| LeaveRequestController | /api/leave-requests | 7 | HR |
| PayrollController | /api/payroll | 8 | Payroll |
| RecognitionAwardController | /api/recognition-awards | 7 | HR |
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.