mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
remove skip
This commit is contained in:
parent
9ba5039e93
commit
a3b5558749
@ -90,17 +90,11 @@ export default class PostsController extends ComplexController {
|
|||||||
select: ["user_id"]
|
select: ["user_id"]
|
||||||
}, async (req, res) => {
|
}, async (req, res) => {
|
||||||
const feedLength = req.query?.feedLength ?? 25
|
const feedLength = req.query?.feedLength ?? 25
|
||||||
const feedSkip = req.query?.feedSkip ?? 0
|
|
||||||
|
|
||||||
let leghtOffset = feedLength * feedSkip
|
|
||||||
|
|
||||||
console.log(leghtOffset, feedSkip)
|
|
||||||
|
|
||||||
// fetch posts from later of lenghtOffset with a maximum of feedLength
|
// fetch posts from later of lenghtOffset with a maximum of feedLength
|
||||||
// make sort by date descending
|
// make sort by date descending
|
||||||
let posts = await Post.find(req.selection)
|
let posts = await Post.find(req.selection)
|
||||||
.sort({ created_at: -1 })
|
.sort({ created_at: -1 })
|
||||||
.skip(leghtOffset)
|
|
||||||
.limit(feedLength)
|
.limit(feedLength)
|
||||||
|
|
||||||
// fetch and add user data to each post
|
// fetch and add user data to each post
|
||||||
|
Loading…
x
Reference in New Issue
Block a user