Initial commit 🍀
This commit is contained in:
commit
b3f42e62af
405 changed files with 31017 additions and 0 deletions
27
src/api/endpoints/messaging/unread.js
Normal file
27
src/api/endpoints/messaging/unread.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import Message from '../../models/messaging-message';
|
||||
|
||||
/**
|
||||
* Get count of unread messages
|
||||
*
|
||||
* @param {Object} params
|
||||
* @param {Object} user
|
||||
* @return {Promise<object>}
|
||||
*/
|
||||
module.exports = (params, user) =>
|
||||
new Promise(async (res, rej) =>
|
||||
{
|
||||
const count = await Message
|
||||
.count({
|
||||
recipient_id: user._id,
|
||||
is_read: false
|
||||
});
|
||||
|
||||
res({
|
||||
count: count
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue