Skip to content

Commit

Permalink
fix: page count in pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael.Taylor committed Jan 5, 2022
1 parent 945c156 commit f99da50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controllers/project.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const findAll = async (req, res) => {
return res.json(
optionallyPaginatedResponse(
await Project.findAndCountAll({
distinct: true,
...query,
...paginationParams(page, limit),
}),
Expand All @@ -105,6 +106,7 @@ export const findAll = async (req, res) => {
return res.json(
optionallyPaginatedResponse(
await Project.findAndCountAll({
distinct: true,
...query,
...paginationParams(page, limit),
}),
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/units.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const findAll = async (req, res) => {
return res.json(
optionallyPaginatedResponse(
await Unit.findAndCountAll({
distinct: true,
attributes: [
'orgUid',
'unitLink',
Expand All @@ -59,6 +60,7 @@ export const findAll = async (req, res) => {
res.json(
optionallyPaginatedResponse(
await Unit.findAndCountAll({
distinct: true,
include: [
{
model: Qualification,
Expand Down

0 comments on commit f99da50

Please sign in to comment.