mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updates for async and await - still
This commit is contained in:
parent
febb36d75f
commit
706c5dc3ef
18 changed files with 220 additions and 233 deletions
|
|
@ -12,7 +12,7 @@ Lists.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.list' (listName, isShared) {
|
||||
async 'add.list' (listName, isShared) {
|
||||
check(listName, String);
|
||||
check(isShared, Boolean);
|
||||
|
||||
|
|
@ -20,14 +20,14 @@ Meteor.methods({
|
|||
throw new Meteor.Error('You are not allowed to add lists. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Lists.insertAsync({
|
||||
return await Lists.insertAsync({
|
||||
listName: listName,
|
||||
listShared: isShared,
|
||||
listOwner: this.userId,
|
||||
listComplete: false,
|
||||
});
|
||||
},
|
||||
'edit.list' (listId, listName, isShared) {
|
||||
async 'edit.list' (listId, listName, isShared) {
|
||||
check(listId, String);
|
||||
check(listName, String);
|
||||
check(isShared, Boolean);
|
||||
|
|
@ -36,55 +36,55 @@ Meteor.methods({
|
|||
throw new Meteor.Error('You are not allowed to edit lists. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Lists.updateAsync({ _id: listId }, {
|
||||
return await Lists.updateAsync({ _id: listId }, {
|
||||
$set: {
|
||||
listName: listName,
|
||||
listShared: isShared,
|
||||
}
|
||||
});
|
||||
},
|
||||
'delete.list' (listId) {
|
||||
async 'delete.list' (listId) {
|
||||
check(listId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to delete lists. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Lists.removeAsync({ _id: listId });
|
||||
return await Lists.removeAsync({ _id: listId });
|
||||
},
|
||||
'mark.complete' (listId) {
|
||||
async '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.');
|
||||
}
|
||||
|
||||
return Lists.updateAsync({ _id: listId }, {
|
||||
return await Lists.updateAsync({ _id: listId }, {
|
||||
$set: {
|
||||
listComplete: true,
|
||||
completedOn: new Date()
|
||||
}
|
||||
});
|
||||
},
|
||||
'mark.incomplete' (listId) {
|
||||
async 'mark.incomplete' (listId) {
|
||||
check(listId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to restore completed lists. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Lists.updateAsync({ _id: listId }, {
|
||||
return await Lists.updateAsync({ _id: listId }, {
|
||||
$set: {
|
||||
listComplete: false,
|
||||
completedOn: new Date()
|
||||
}
|
||||
});
|
||||
},
|
||||
'clean.Lists' () {
|
||||
async 'clean.Lists' () {
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to clean up old lists. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Lists.removeAsync({ listComplete: true });
|
||||
return await Lists.removeAsync({ listComplete: true });
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue