mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
performance: private messages - API (#11077)
* paging for inbox * clean up
This commit is contained in:
@@ -11,6 +11,8 @@ let api = {};
|
||||
* @apiGroup Inbox
|
||||
* @apiDescription Get inbox messages for a user
|
||||
*
|
||||
* @apiParam (Query) {Number} page Load the messages of the selected Page - 10 Messages per Page
|
||||
*
|
||||
* @apiSuccess {Array} data An array of inbox messages
|
||||
*/
|
||||
api.getInboxMessages = {
|
||||
@@ -19,8 +21,11 @@ api.getInboxMessages = {
|
||||
middlewares: [authWithHeaders()],
|
||||
async handler (req, res) {
|
||||
const user = res.locals.user;
|
||||
const page = req.query.page;
|
||||
|
||||
const userInbox = await inboxLib.getUserInbox(user);
|
||||
const userInbox = await inboxLib.getUserInbox(user, {
|
||||
page,
|
||||
});
|
||||
|
||||
res.respond(200, userInbox);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user