Updated the models.

This commit is contained in:
2022-06-20 08:24:35 -07:00
parent f5e98bee03
commit 6c6778d58e
14 changed files with 661 additions and 3186 deletions

25
imports/api/staff.js Normal file
View File

@@ -0,0 +1,25 @@
import {Mongo} from "meteor/mongo";
import {Meteor} from "meteor/meteor";
import { Roles } from 'meteor/alanning:roles';
export const Staff = new Mongo.Collection('staff');
if (Meteor.isServer) {
// This code only runs on the server
Meteor.publish('staff', function(siteId) {
return Staff.find({siteId});
});
}
Meteor.methods({
'staff.add'(firstName, lastName, email, siteId) {
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
Staff.insert({firstName, lastName, email, siteId});
}
},
'staff.remove'(_id) {
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
//TODO: Need to first verify there are no checked out assets to the staff member.
}
},
});