Adding more methods and views, updated dashboards a bit. Still not ready

This commit is contained in:
Brian McGonagill 2022-08-16 16:46:14 -05:00
parent 266dbd0856
commit 42643a37f5
23 changed files with 374 additions and 32 deletions

View file

@ -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!");
}
}
});