Files
kulakpos_web/walkthroughs/2026-05-05_95087241_Walkthrough__Overtime_Delegation_Rejection_API.md

33 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2026-05-14 11:55:22 +07:00
# 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 to `6`, records the rejection NIK, comment, and timestamp.
- Updated `getOvertimeDelegationHistory`: Now includes `reject_by`, `comment_reject`, `timestamp_reject`, and `name_reject_by` in the response.
### 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/reject` route.
## Verification Results
### API Test
The new endpoint can be tested with the following structure:
- **URL**: `/api/delegations/overtime/reject`
- **Method**: `POST`
- **Body**:
```json
{
"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.