1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-29 05:58:15 +09:00
MisskeyIO/src/api/endpoints/messaging/unread.ts
2017-03-04 04:28:38 +09:00

24 lines
391 B
TypeScript

/**
* Module dependencies
*/
import Message from '../../models/messaging-message';
/**
* Get count of unread messages
*
* @param {any} params
* @param {any} user
* @return {Promise<any>}
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
const count = await Message
.count({
recipient_id: user._id,
is_read: false
});
res({
count: count
});
});