mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
added /saved_posts
endpoint
This commit is contained in:
parent
908f691625
commit
57415eea74
@ -18,7 +18,21 @@ export default class PostsController extends Controller {
|
||||
skip: req.query?.trim,
|
||||
from_user_id: req.query?.user_id,
|
||||
for_user_id: req.user?._id.toString(),
|
||||
savedOnly: req.query?.savedOnly,
|
||||
})
|
||||
|
||||
return res.json(posts)
|
||||
})
|
||||
},
|
||||
"/saved_posts": {
|
||||
middlewares: ["withOptionalAuthentication"],
|
||||
fn: Schematized({
|
||||
select: ["user_id"]
|
||||
}, async (req, res) => {
|
||||
let posts = await GetPostData({
|
||||
limit: req.query?.limit,
|
||||
skip: req.query?.trim,
|
||||
for_user_id: req.user?._id.toString(),
|
||||
savedOnly: true,
|
||||
})
|
||||
|
||||
return res.json(posts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user