mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2025-03-13 12:11:06 +02:00
23 lines
400 B
TypeScript
23 lines
400 B
TypeScript
/**
|
|
* Module dependencies
|
|
*/
|
|
import Notification from '../../models/notification';
|
|
|
|
/**
|
|
* Get count of unread notifications
|
|
*
|
|
* @param {any} params
|
|
* @param {any} user
|
|
* @return {Promise<any>}
|
|
*/
|
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
|
const count = await Notification
|
|
.count({
|
|
notifiee_id: user._id,
|
|
is_read: false
|
|
});
|
|
|
|
res({
|
|
count: count
|
|
});
|
|
});
|