Updated the models.
This commit is contained in:
25
imports/api/staff.js
Normal file
25
imports/api/staff.js
Normal 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.
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user