Implemented an API to retrieve a pending checkout and pending regularization request for logged in employee #70
Collaborator
- Get Tenant and Employee Info:
- Retrieve the current tenant ID using _userHelper.GetTenantId().
- Get the currently logged-in employee using _userHelper.GetCurrentEmployeeAsync().
- Fetch Attendance Records:
- Query the Attendes table for records:
- Belonging to the current tenant
- Associated with the logged-in employee
- Query the Attendes table for records:
- Check Attendance Records:
- If attendance records exist:
- Calculate:
- PendingRegularization: Count of attendance entries with Activity == REQUEST_REGULARIZE
- PendingCheckOut: Count of entries where OutTime is null (indicating the employee hasn’t checked out yet)
- Calculate:
- If attendance records exist:
- Prepare and Return Response:
- Create an anonymous response object with the two counts.
- Log an info message that pending items were fetched successfully.
- Return a 200 OK response wrapped in ApiResponse
- **Get Tenant and Employee Info**:
- Retrieve the current tenant ID using _userHelper.GetTenantId().
- Get the currently logged-in employee using _userHelper.GetCurrentEmployeeAsync().
- **Fetch Attendance Records**:
- Query the Attendes table for records:
- Belonging to the current tenant
- Associated with the logged-in employee
- **Check Attendance Records**:
- If attendance records exist:
- Calculate:
- PendingRegularization: Count of attendance entries with Activity == REQUEST_REGULARIZE
- PendingCheckOut: Count of entries where OutTime is null (indicating the employee hasn’t checked out yet)
- **Prepare and Return Response**:
- Create an anonymous response object with the two counts.
- Log an info message that pending items were fetched successfully.
- Return a 200 OK response wrapped in ApiResponse<object>.SuccessResponse(...).
- **If No Records Found**:
- Log an error message indicating no attendance entries exist.
- Return a 404 Not Found with an error response.
ashutosh.nehete
added 1 commit 2025-05-23 12:20:33 +00:00
Merge pull request 'Implemented an API to retrieve a pending checkout and pending regularization request for logged in employee' (#70) from Ashutosh_Task#346_Pending_Attendance into Issue_May_4W
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "Ashutosh_Task#346_Pending_Attendance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?