mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Adding functionality for Tasks.
This commit is contained in:
parent
947abfb76f
commit
56b27d6b05
13 changed files with 234 additions and 9 deletions
|
|
@ -12,19 +12,33 @@ TaskItems.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.task' (taskName, assignedTo, taskDate) {
|
||||
'add.task' (taskName, assignedTo, assignedToId, taskDate, actDate) {
|
||||
check(taskName, String);
|
||||
check(assignedTo, String);
|
||||
check(taskDate, String);
|
||||
check(assignedToId, 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,
|
||||
assignedTo: assignedTo,
|
||||
actualDate: actDate,
|
||||
assignedTo: username,
|
||||
assignedToId: assignedToId,
|
||||
isComplete: false,
|
||||
completedOn: null,
|
||||
assignedOn: new Date(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue