Added the ability to create and edit students and staff. Still cannot delete.
This commit is contained in:
@@ -4,6 +4,7 @@ import { check } from 'meteor/check';
|
||||
import {Sites} from "./sites";
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import {parse} from 'csv-parse';
|
||||
import {Staff} from "/imports/api/staff";
|
||||
|
||||
// console.log("Setting Up Students...")
|
||||
|
||||
@@ -19,6 +20,21 @@ if (Meteor.isServer) {
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'students.add'(id, firstName, lastName, email, siteId, grade) {
|
||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
Students.insert({id, firstName, lastName, email, siteId, grade});
|
||||
}
|
||||
},
|
||||
'students.update'(_id, id, firstName, lastName, email, siteId, grade) {
|
||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
Students.update({_id}, {$set: {id, firstName, lastName, email, siteId, grade}});
|
||||
}
|
||||
},
|
||||
'students.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.
|
||||
}
|
||||
},
|
||||
'students.getPossibleGrades'() {
|
||||
return Students.rawCollection().distinct('grade', {});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user