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:
Mohammed AbadandCopilot committed 2026-04-27 13:29:16 +01:00
1 parent 8aca121b10
commit 6d676d803c
5 files changed
+57 -87

No files matched your search

+10 -1
View File
@@ -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);
}