mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-19 00:17:35 -07: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
|
|
});
|
|
});
|