wip
This commit is contained in:
parent
bac1de6620
commit
e2d7e50621
|
@ -25,16 +25,13 @@ export async function readNotificationByQuery(
|
||||||
userId: User['id'],
|
userId: User['id'],
|
||||||
query: Record<string, any>
|
query: Record<string, any>
|
||||||
) {
|
) {
|
||||||
// Update documents
|
const notificationIds = await Notifications.find({
|
||||||
await Notifications.update({
|
|
||||||
...query,
|
...query,
|
||||||
notifieeId: userId,
|
notifieeId: userId,
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}).then(notifications => notifications.map(notification => notification.id));
|
||||||
isRead: true
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!await Users.getHasUnreadNotification(userId)) return postReadAllNotifications(userId);
|
return readNotification(userId, notificationIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
function postReadAllNotifications(userId: User['id']) {
|
function postReadAllNotifications(userId: User['id']) {
|
||||||
|
|
Loading…
Reference in a new issue