mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Adding more methods and views, updated dashboards a bit. Still not ready
This commit is contained in:
parent
266dbd0856
commit
42643a37f5
23 changed files with 374 additions and 32 deletions
|
|
@ -21,7 +21,8 @@ Meteor.methods({
|
|||
|
||||
return Lists.insert({
|
||||
listName: listName,
|
||||
listOwner: this.userId;
|
||||
listOwner: this.userId,
|
||||
listComplete: false,
|
||||
});
|
||||
},
|
||||
'edit.list' (listId, listName) {
|
||||
|
|
@ -47,11 +48,32 @@ Meteor.methods({
|
|||
|
||||
let listInfo = Lists.findOne({ _id: listId });
|
||||
let myId = this.userId;
|
||||
if (myId == listInfo.owner) {
|
||||
if (myId == listInfo.listOwner) {
|
||||
return Lists.remove({ _id: listId });
|
||||
} else {
|
||||
console.log("User not allowed to delete this list. Not the owner!");
|
||||
return("Not Allowed!");
|
||||
}
|
||||
},
|
||||
'mark.complete' (listId) {
|
||||
check(listId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to mark lists complete. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
let listInfo = Lists.findOne({ _id: listId });
|
||||
let myId = this.userId;
|
||||
if (myId == listInfo.listOwner) {
|
||||
return Lists.update({ _id: listId }, {
|
||||
$set: {
|
||||
listComplete: true,
|
||||
completedOn: new Date()
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("User not allowed to mark lists complete. Not a member of the list!");
|
||||
return("Not Allowed!");
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue