Skip to content

Commit e30591f

Browse files
committed
fix: paginated copilot request
1 parent e439cc8 commit e30591f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/routes/copilotRequest/list.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ module.exports = [
3535

3636
const whereCondition = projectId ? { projectId } : {};
3737

38-
return models.CopilotRequest.findAll({
38+
return models.CopilotRequest.findAndCountAll({
3939
where: whereCondition,
4040
include: [
4141
{ model: models.CopilotOpportunity, as: 'copilotOpportunity', required: false },
4242
],
4343
order: [[sortParams[0], sortParams[1]]],
4444
limit: pageSize,
4545
offset,
46-
}).then((copilotRequests) => util.setPaginationHeaders(req, res, {
47-
count: copilotRequests.count,
46+
distinct: true,
47+
subQuery: false,
48+
}).then((copilotRequests, count) => util.setPaginationHeaders(req, res, {
49+
count: count,
4850
rows: copilotRequests,
4951
page,
5052
pageSize,

0 commit comments

Comments
 (0)