feat(auth-manager): added support for pagination and sort for client#67
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR extends the client API with pagination and sorting support.
- ClientManager and controller are updated to accept pagination and sort parameters.
- Integration and unit tests are expanded to cover paging and sorting.
- OpenAPI spec, error classes, and utility functions for pagination/sorting are added.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/client/models/clientManager.ts | Updated getClients to use findAndCount, accept pagination & sort |
| src/client/controllers/clientController.ts | Parsed query page, pageSize, and sort; JSON response shape updated |
| src/common/db/pagination.ts | Added pagination parameter converter |
| src/common/db/sort.ts | Added sort parser with validation and custom errors |
| common/errors.ts | Introduced SortQueryRepeatError and SortQueryInvalidFieldError |
| openapi3.yaml | Added sort, page, pageSize parameters and pagination response schema |
| tests/unit/client/models/clientManager.spec.ts | Switched mocks to findAndCount and updated expectations |
| tests/integration/client/client.spec.ts | Added pagination & sort test cases and DB cleanup after each test |
| package.json | Integration tests now run serially (--runInBand) |
| CHANGELOG.md | Updated changelog entries |
Comments suppressed due to low confidence (2)
packages/auth-manager/tests/integration/client/client.spec.ts:339
- [nitpick] The
describe('POST /client')block was removed, which may prevent POST tests from being grouped or executed correctly. Consider restoring the describe wrapper for clarity and coverage.
- describe('POST /client', function () {
packages/auth-manager/CHANGELOG.md:10
- Changelog entries appear duplicated and inconsistent in formatting. Please consolidate or remove the redundant lines to maintain a clean history.
- Revert "v1.3.0" ([46da5ec](https://github.com/MapColonies/opa-la/commit/46da5ecd82107d5a49631b5a96738cb5766131c0))
Comment on lines
+57
to
+58
| page: req.query?.page ?? 1, | ||
| pageSize: req.query?.pageSize ?? DEFAULT_PAGE_SIZE, |
There was a problem hiding this comment.
Express req.query values are strings; convert page and pageSize to numbers (e.g. page: Number(req.query.page)) to ensure correct arithmetic in skip/take.
Suggested change
| page: req.query?.page ?? 1, | |
| pageSize: req.query?.pageSize ?? DEFAULT_PAGE_SIZE, | |
| page: req.query?.page ? parseInt(req.query.page, 10) || 1 : 1, | |
| pageSize: req.query?.pageSize ? parseInt(req.query.pageSize, 10) || DEFAULT_PAGE_SIZE : DEFAULT_PAGE_SIZE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.