-
Notifications
You must be signed in to change notification settings - Fork 0
feat(backend): add request state param to count endpoint (SCRUM-XXX) #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend): add request state param to count endpoint (SCRUM-XXX) #202
Conversation
64955b9 to
81f725e
Compare
Changed supervision requests count endpoint to accept any request state. Route updated from /pending-count/:userId to /count/:userId with required request_state query parameter. Enables counting of PENDING, ACCEPTED, REJECTED, or WITHDRAWN requests instead of only pending ones.
…ion-request-count.entity.ts
3d2fe22 to
010a19d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
The PR generalizes the supervision requests count endpoint to accept a request_state filter, replacing the previous hardcoded pending-only count.
- Renames and parameterizes the service method and return entity to handle any
RequestState - Updates the controller route, DTO, Swagger docs, and OpenAPI spec to require a
request_statequery parameter - Refactors and extends tests to cover multiple states and removes the old pending-only entity
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| supervision-requests.service.ts | Renamed method/entity, added requestState parameter, updated return shape |
| supervision-requests.service.spec.ts | Updated tests to call new method with different states |
| supervision-requests.controller.ts | Changed route and method name, added DTO and @ApiQuery |
| supervision-requests.controller.spec.ts | Updated controller tests for new query parameter |
| supervision-request-count.entity.ts | Added new SupervisionRequestCountEntity |
| pending-request-count.entity.ts | Removed old pending-only entity contents |
| dto/count-query.dto.ts | Introduced CountQueryDto for validating request_state |
| OpenAPI.json | Updated path, parameters, response schema, and component names |
Comments suppressed due to low confidence (3)
backend/src/modules/requests/supervision/supervision-requests.controller.spec.ts:384
- Add tests for cases where the
request_statequery parameter is missing or invalid to ensure the controller returns a 400 Bad Request with the appropriate validation error.
describe('getRequestCountForUser', () => {
backend/src/modules/requests/supervision/supervision-requests.service.ts:319
- Ensure that the
RequestStateenum is imported at the top of this file (e.g.import { RequestState } from '@prisma/client';) to prevent compile errors.
requestState: RequestState,
|
@nb159 use this via the proxy for now, as the nuxt api endpoint does not exist yet (I will tell you when its there) |
📝 Example Usage