Removed references to the aggregate code; Commented out the import of the meteor package.
This commit is contained in:
@@ -47,13 +47,14 @@ if (Meteor.isServer) {
|
||||
|
||||
// This code only runs on the server
|
||||
Meteor.publish('assetAssignments', function(assetId) {
|
||||
let query = {};
|
||||
|
||||
if(assetId) {
|
||||
query.assetId = assetId;
|
||||
}
|
||||
|
||||
return AssetAssignments.find(query);
|
||||
// let query = {};
|
||||
//
|
||||
// if(assetId) {
|
||||
// query.assetId = assetId;
|
||||
// }
|
||||
//
|
||||
// return AssetAssignments.find(query);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
Meteor.methods({
|
||||
@@ -69,25 +70,25 @@ Meteor.methods({
|
||||
* @param assigneeId The Mongo ID of the Student or Staff (person._id).
|
||||
*/
|
||||
'AssetAssignments.add'(assetId, assigneeType, assigneeId) {
|
||||
check(assigneeId, String);
|
||||
check(assigneeType, String);
|
||||
check(assetId, String);
|
||||
|
||||
if(assigneeType !== 'Student' && assigneeType !== 'Staff') {
|
||||
// Should never happen.
|
||||
console.error("Error: Received incorrect assignee type in adding an assignment.");
|
||||
console.error(assigneeType);
|
||||
}
|
||||
else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
AssetAssignments.insert({assetId, assigneeType, assigneeId});
|
||||
}
|
||||
// check(assigneeId, String);
|
||||
// check(assigneeType, String);
|
||||
// check(assetId, String);
|
||||
//
|
||||
// if(assigneeType !== 'Student' && assigneeType !== 'Staff') {
|
||||
// // Should never happen.
|
||||
// console.error("Error: Received incorrect assignee type in adding an assignment.");
|
||||
// console.error(assigneeType);
|
||||
// }
|
||||
// else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
// AssetAssignments.insert({assetId, assigneeType, assigneeId});
|
||||
// }
|
||||
},
|
||||
'AssetAssignments.remove'(_id) {
|
||||
check(_id, String);
|
||||
|
||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
//TODO: Need to first verify there are no checked out assets to the staff member.
|
||||
}
|
||||
// check(_id, String);
|
||||
//
|
||||
// if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
// //TODO: Need to first verify there are no checked out assets to the staff member.
|
||||
// }
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { check } from 'meteor/check';
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
//import SimpleSchema from "simpl-schema";
|
||||
import {AssetTypes} from "./asset-types";
|
||||
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
|
||||
import {AssetAssignments} from "/imports/api/asset-assignments";
|
||||
|
||||
export const Assets = new Mongo.Collection('assets');
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Roles } from 'meteor/alanning:roles';
|
||||
import {check} from "meteor/check";
|
||||
import {Sites} from "/imports/api/sites";
|
||||
import {parse} from "csv-parse";
|
||||
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
|
||||
|
||||
export const Staff = new Mongo.Collection('staff');
|
||||
|
||||
@@ -13,15 +12,6 @@ if (Meteor.isServer) {
|
||||
Meteor.publish('staff', function(siteId) {
|
||||
return Staff.find({siteId});
|
||||
});
|
||||
Meteor.publish('staffWithAssetAssignments', function(query) {
|
||||
ReactiveAggregate(this, Staff, {$lookup: {
|
||||
from: 'assetAssignments',
|
||||
localField: '_id',
|
||||
foreignField: 'assigneeId',
|
||||
as: 'assignments'
|
||||
}}, {});
|
||||
//Note: The options can use {clientCollection: 'your_name_here'} as the options to change the collection name on the client.
|
||||
});
|
||||
}
|
||||
Meteor.methods({
|
||||
'staff.add'(firstName, lastName, email, siteId) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import { check } from 'meteor/check';
|
||||
import {Sites} from "./sites";
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import {parse} from 'csv-parse';
|
||||
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
|
||||
|
||||
export const Students = new Mongo.Collection('students');
|
||||
|
||||
@@ -15,15 +14,6 @@ if (Meteor.isServer) {
|
||||
Meteor.publish('students', function(siteId) {
|
||||
return Students.find({siteId});
|
||||
});
|
||||
Meteor.publish('studentWithAssetAssignments', function(query) {
|
||||
ReactiveAggregate(this, Students, {$lookup: {
|
||||
from: 'assetAssignments',
|
||||
localField: '_id',
|
||||
foreignField: 'assigneeId',
|
||||
as: 'assignments'
|
||||
}}, {});
|
||||
//Note: The options can use {clientCollection: 'your_name_here'} as the options to change the collection name on the client.
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'students.getPossibleGrades'() {
|
||||
|
||||
Reference in New Issue
Block a user