mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
fix: session pagination
This commit is contained in:
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) {
|
export async function sessionListController(req, res) {
|
||||||
const { nextKey } = req.query
|
const { nextKey } = req.query
|
||||||
const itemsPerPage = 10
|
const itemsPerPage = 50
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// const totalSessions = await sessionCount()
|
// const totalSessions = await sessionCount()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export async function sessionList({ nextKey, itemsPerPage, order }) {
|
|||||||
let matchStage = {}
|
let matchStage = {}
|
||||||
if (nextKey) {
|
if (nextKey) {
|
||||||
const key = new mongoose.Types.ObjectId(nextKey)
|
const key = new mongoose.Types.ObjectId(nextKey)
|
||||||
matchStage = { user: order.matchStage(key) }
|
matchStage = { _id: order.matchStage(key) }
|
||||||
}
|
}
|
||||||
const sessions = await Session.aggregate([
|
const sessions = await Session.aggregate([
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user