mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Many chcanges, but version 0.1.0 is ready to be cut.
This commit is contained in:
parent
42643a37f5
commit
6e37ae8c74
46 changed files with 1038 additions and 273 deletions
|
|
@ -12,8 +12,9 @@ Lists.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.list' (listName) {
|
||||
'add.list' (listName, isShared) {
|
||||
check(listName, String);
|
||||
check(isShared, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add lists. Make sure you are logged in with valid user credentials.');
|
||||
|
|
@ -21,13 +22,15 @@ Meteor.methods({
|
|||
|
||||
return Lists.insert({
|
||||
listName: listName,
|
||||
listShared: isShared,
|
||||
listOwner: this.userId,
|
||||
listComplete: false,
|
||||
});
|
||||
},
|
||||
'edit.list' (listId, listName) {
|
||||
'edit.list' (listId, listName, isShared) {
|
||||
check(listId, String);
|
||||
check(listName, String);
|
||||
check(isShared, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to edit lists. Make sure you are logged in with valid user credentials.');
|
||||
|
|
@ -36,6 +39,7 @@ Meteor.methods({
|
|||
return Lists.update({ _id: listId }, {
|
||||
$set: {
|
||||
listName: listName,
|
||||
listShared: isShared,
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -62,18 +66,11 @@ Meteor.methods({
|
|||
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!");
|
||||
}
|
||||
return Lists.update({ _id: listId }, {
|
||||
$set: {
|
||||
listComplete: true,
|
||||
completedOn: new Date()
|
||||
}
|
||||
});;
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue