remove skip

This commit is contained in:
srgooglo 2022-03-14 22:59:23 +01:00
parent 9ba5039e93
commit a3b5558749

View File

@ -90,17 +90,11 @@ export default class PostsController extends ComplexController {
select: ["user_id"]
}, async (req, res) => {
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
// make sort by date descending
let posts = await Post.find(req.selection)
.sort({ created_at: -1 })
.skip(leghtOffset)
.limit(feedLength)
// fetch and add user data to each post