Initial cut - untested.

This commit is contained in:
2025-09-25 09:31:02 -07:00
parent 7a0666cc6c
commit 3775522265
33 changed files with 351 additions and 346 deletions

View File

@@ -25,7 +25,7 @@ if(Meteor.isServer) {
});
}
Meteor.methods({
'workshops.add'(name, description, signupLimit) {
async 'workshops.add'(name, description, signupLimit) {
let signupSheet = [];
console.log(name)
@@ -40,10 +40,10 @@ Meteor.methods({
}))
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
Workshops.insert({name, description, signupLimit, signupSheet});
await Workshops.insertAsync({name, description, signupLimit, signupSheet});
}
},
'workshops.update'(_id, name, description, signupLimit) {
async 'workshops.update'(_id, name, description, signupLimit) {
check(_id, String);
check(name, String);
check(description, String);
@@ -54,45 +54,45 @@ Meteor.methods({
}))
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
Workshops.update({_id}, {$set: {name, description, signupLimit}});
await Workshops.updateAsync({_id}, {$set: {name, description, signupLimit}});
}
},
'workshops.signup'(_id) {
async 'workshops.signup'(_id) {
check(_id, String);
if(Meteor.userId()) {
let workshop = Workshops.findOne(_id);
let workshop = await Workshops.findOneAsync(_id);
if(workshop) {
if(!workshop.signupLimit || workshop.signedUp.length < workshop.signupLimit) {
Workshops.update({_id}, {$push: {signupSheet: {_id: Meteor.userId()}}});
await Workshops.updateAsync({_id}, {$push: {signupSheet: {_id: Meteor.userId()}}});
}
}
}
},
'workshops.unsignup'(_id) {
async 'workshops.unsignup'(_id) {
check(_id, String);
if(Meteor.userId()) {
let workshop = Workshops.findOne(_id);
let workshop = await Workshops.findOneAsync(_id);
if(workshop) {
Workshops.update({_id}, {$pull: {signupSheet: {_id: Meteor.userId()}}});
await Workshops.updateAsync({_id}, {$pull: {signupSheet: {_id: Meteor.userId()}}});
}
}
},
'workshops.complete'(_id) {
async 'workshops.complete'(_id) {
check(_id, String);
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
Workshops.update({_id}, {$set: {isComplete: true}})
await Workshops.updateAsync({_id}, {$set: {isComplete: true}})
}
},
'workshops.remove'(_id) {
async 'workshops.remove'(_id) {
check(_id, String);
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
Workshops.remove({_id})
await Workshops.removeAsync({_id})
}
},
});