Removed references to the aggregate code; Commented out the import of the meteor package.

This commit is contained in:
2022-08-14 17:31:34 -07:00
parent cf51200393
commit 071534a420
5 changed files with 26 additions and 46 deletions

View File

@@ -37,4 +37,4 @@ msavin:mongol # Free version of MeteorToys - Provides access t
#zodern:melte # Alternative to meteor-svelte (https://github.com/meteor-svelte/meteor-svelte). Was more actively developed.
svelte:compiler # Switching back to this because of TS errors.
tunguska:reactive-aggregate # Allows us to create a new client collection (from the server) with the contents being an aggregate of server data. Note that aggregation can only be done on the server currently as mini-mongo does not support it.
#tunguska:reactive-aggregate # Allows us to create a new client collection (from the server) with the contents being an aggregate of server data. Note that aggregation can only be done on the server currently as mini-mongo does not support it.

View File

@@ -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.
// }
},
});

View File

@@ -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');

View File

@@ -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) {

View File

@@ -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'() {