Updating tasks to show incomplete, overdue items

This commit is contained in:
Brian McGonagill 2022-09-16 16:19:53 -05:00
parent 5e80ab7f6b
commit cf715c9dbf
4 changed files with 37 additions and 4 deletions

View file

@ -49,6 +49,37 @@ Meteor.methods({
}
}
},
'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) {
check(taskName, String);
check(taskDate, String);
check(actDate, Date);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to add tasks. Make sure you are logged in with valid user credentials.');
}
let username;
if (assignedTo == "self") {
let userInfo = Meteor.users.findOne({ _id: this.userId });
username = userInfo.profile.fullname;
assignedToId = this.userId;
} else {
username = assignedTo;
}
return TaskItems.insert({
taskName: taskName,
taskDate: taskDate,
actualDate: actDate,
assignedTo: username,
assignedToId: assignedToId,
isComplete: false,
completedOn: null,
assignedOn: new Date(),
assignedBy: this.userId,
});
},
'edit.task' (taskId, taskName, assignedTo, taskDate) {
check(taskId, String);
check(taskName, String);