- Tasks are assigned to users manually or automatically (e.g., based on role or previous task completion).
- Task assignees must accept the task before it appears in their task list.
- Team leads or admins can assign tasks to users within their teams.
- Admin or lead assigns a task to a user
- User is notified of the task and accepts or rejects it
- Once accepted, the task moves to the user's "In Progress" list
- User submits task upon completion
- Upon assignment: "You have been assigned a new task."
- Upon submission: "Task [Task Name] is awaiting review."
if (!userIsEligibleForTask(user, task)) {
throw new Error('User cannot be assigned this task');
}
task.assignedTo.push(user._id);
task.save();