Skip to content

feat(auth-manager): added support for pagination and sort for client#67

Merged
CptSchnitz merged 1 commit into
masterfrom
clients-sort-pagination
Jun 16, 2025
Merged

feat(auth-manager): added support for pagination and sort for client#67
CptSchnitz merged 1 commit into
masterfrom
clients-sort-pagination

Conversation

@CptSchnitz

Copy link
Copy Markdown
Contributor

No description provided.

@CptSchnitz CptSchnitz requested a review from Copilot June 16, 2025 12:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copilot AI Jun 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copilot uses AI. Check for mistakes.
@CptSchnitz CptSchnitz merged commit bf17d96 into master Jun 16, 2025
10 checks passed
@CptSchnitz CptSchnitz deleted the clients-sort-pagination branch June 16, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants