1.3 KiB
1.3 KiB
Walkthrough - Overtime Delegation Rejection API
I have implemented the rejection mechanism for the Overtime Delegation module. This allows superiors to reject delegation requests with a reason.
Changes Made
Backend Service
- [delegation-overtime-services.js](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS PROJECT/ess_api/ess_api/app/services/delegation-overtime-services.js):
- Implemented
rejectOvertimeDelegation: Updates status to6, records the rejection NIK, comment, and timestamp. - Updated
getOvertimeDelegationHistory: Now includesreject_by,comment_reject,timestamp_reject, andname_reject_byin the response.
- Implemented
Backend Routes
- [delegation-routes.js](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS PROJECT/ess_api/ess_api/app/routes/delegation-routes.js):
- Added
POST /api/delegations/overtime/rejectroute.
- Added
Verification Results
API Test
The new endpoint can be tested with the following structure:
- URL:
/api/delegations/overtime/reject - Method:
POST - Body:
{
"id": 123,
"nik": "DELEGATOR_NIK",
"reject_by": "REJECTOR_NIK",
"comment_reject": "Rejected because of change in schedule"
}
The history endpoint /api/delegations/overtime/history will now return the rejection details for rejected items.