WIP(teams): display assigned tasks on user's personal board

This commit is contained in:
SabreCat
2022-06-13 16:53:29 -05:00
parent 9fec111c4d
commit a0177fa44d
12 changed files with 106 additions and 136 deletions

View File

@@ -150,7 +150,7 @@ async function getTasks (req, res, options = {}) {
dueDate,
} = options;
let query = { userId: user._id };
let query = { $or: [{ userId: user._id }, { 'group.assignedUsers': user._id }] };
let limit;
let sort;
const owner = group || challenge || user;
@@ -188,10 +188,12 @@ async function getTasks (req, res, options = {}) {
query.type = type.slice(0, -1); // removing the final "s"
}
} else {
query.$or = [ // Exclude completed todos
{ type: 'todo', completed: false },
{ type: { $in: ['habit', 'daily', 'reward'] } },
];
query.$and = [{
$or: [ // Exclude completed todos
{ type: 'todo', completed: false },
{ type: { $in: ['habit', 'daily', 'reward'] } },
],
}];
}
const mQuery = Tasks.Task.find(query);