Skip to content

Commit 464db62

Browse files
authored
fix(events): use _count for correct attendees pagination total (#236)
1 parent 561cfc5 commit 464db62

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/backend/src/routes/event.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export async function eventRoutes(app:FastifyInstance) {
221221
slug: paramsSlug
222222
},
223223
include: {
224+
_count: {
225+
select: { attendees: true }
226+
},
224227
attendees : {
225228
include: {
226229
user: {
@@ -264,7 +267,7 @@ export async function eventRoutes(app:FastifyInstance) {
264267
pagination: {
265268
page,
266269
limit,
267-
total : event.attendees.length,
270+
total : event._count.attendees,
268271
}
269272
}
270273

0 commit comments

Comments
 (0)