feat(people): add pagination support to getAllPeople endpoint
Support optional page, limit, and search query params.
Returns { data, total, page, totalPages } when paginated,
plain array for backward compatibility.
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
1 parent
8aca121b10
commit
6d676d803c
5 files changed
+57
-87
No files matched your search
@@ -14,7 +14,16 @@ class PeopleController {
|
||||
}
|
||||
|
||||
async getAllPeople(req, res) {
|
||||
const people = await _peopleService.getAllPeople();
|
||||
const { page, limit, search } = req.query;
|
||||
const options = {};
|
||||
if (page && limit) {
|
||||
options.page = parseInt(page);
|
||||
options.limit = parseInt(limit);
|
||||
}
|
||||
if (search) {
|
||||
options.search = search;
|
||||
}
|
||||
const people = await _peopleService.getAllPeople(false, options);
|
||||
res.status(200).json(people);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user