mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add sorting order
This commit is contained in:
1 parent
1b94ae75ca
commit
c6733814ba
3 files changed
+39
-7
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { Desc } from '../constants.js'
|
||||
import { userList, userCount } from '../models/users.js'
|
||||
|
||||
export async function userListController(req, res) {
|
||||
@@ -8,7 +9,11 @@ export async function userListController(req, res) {
|
||||
// const totalUsers = await userCount()
|
||||
// const maxPages = Math.ceil(totalUsers / itemsPerPage)
|
||||
|
||||
const users = await userList({ nextKey, itemsPerPage })
|
||||
const users = await userList({
|
||||
nextKey,
|
||||
itemsPerPage,
|
||||
order: new Desc(),
|
||||
})
|
||||
const newNextKey = users[users.length - 1]?._id
|
||||
|
||||
res.render('users', {
|
||||
|
||||
Reference in new issue
Block a user