fix: session pagination

This commit is contained in:
Chen, Tai-Lin committed 2023-12-21 16:37:37 +08:00
1 parent bc0055781e
commit 19cd10ab7b
2 files changed
+2 -2

No files matched your search

@@ -3,7 +3,7 @@ import { sessionCount, sessionList, sessionDetail } from '../models/sessions.js'
export async function sessionListController(req, res) {
const { nextKey } = req.query
const itemsPerPage = 10
const itemsPerPage = 50
try {
// const totalSessions = await sessionCount()
+1 -1
View File
@@ -35,7 +35,7 @@ export async function sessionList({ nextKey, itemsPerPage, order }) {
let matchStage = {}
if (nextKey) {
const key = new mongoose.Types.ObjectId(nextKey)
matchStage = { user: order.matchStage(key) }
matchStage = { _id: order.matchStage(key) }
}
const sessions = await Session.aggregate([
{