mirror of
https://github.com/plankanban/planka.git
synced 2025-07-22 06:39:44 +02:00
parent
ad7fb51cfa
commit
2ee1166747
1557 changed files with 76832 additions and 47042 deletions
|
@ -1,24 +1,21 @@
|
|||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
async fn() {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const notifications = await sails.helpers.users.getNotifications(currentUser.id);
|
||||
const notifications = await Notification.qm.getUnreadByUserId(currentUser.id);
|
||||
|
||||
const actionIds = sails.helpers.utils.mapRecords(notifications, 'actionId');
|
||||
const actions = await sails.helpers.actions.getMany(actionIds);
|
||||
|
||||
const userIds = sails.helpers.utils.mapRecords(actions, 'userId', true);
|
||||
const users = await sails.helpers.users.getMany(userIds, true);
|
||||
|
||||
const cardIds = sails.helpers.utils.mapRecords(notifications, 'cardId');
|
||||
const cards = await sails.helpers.cards.getMany(cardIds);
|
||||
const userIds = sails.helpers.utils.mapRecords(notifications, 'creatorUserId', true, true);
|
||||
const users = await User.qm.getByIds(userIds);
|
||||
|
||||
return {
|
||||
items: notifications,
|
||||
included: {
|
||||
users,
|
||||
cards,
|
||||
actions,
|
||||
users: sails.helpers.users.presentMany(users, currentUser),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue