mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 12:33:09 +02:00
27 lines
407 B
TypeScript
27 lines
407 B
TypeScript
'use strict';
|
|
|
|
/**
|
|
* 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
|
|
});
|
|
});
|