Merge remote-tracking branch 'origin/master'

This commit is contained in:
2022-08-15 07:01:49 -07:00
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. #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. 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

@@ -49,13 +49,14 @@ if (Meteor.isServer) {
// This code only runs on the server // This code only runs on the server
Meteor.publish('assetAssignments', function(assetId) { Meteor.publish('assetAssignments', function(assetId) {
let query = {}; // let query = {};
//
if(assetId) { // if(assetId) {
query.assetId = assetId; // query.assetId = assetId;
} // }
//
return AssetAssignments.find(query); // return AssetAssignments.find(query);
return [];
}); });
} }
Meteor.methods({ Meteor.methods({
@@ -66,25 +67,25 @@ Meteor.methods({
* @param assigneeId The Mongo ID of the Student or Staff (person._id). * @param assigneeId The Mongo ID of the Student or Staff (person._id).
*/ */
'AssetAssignments.add'(assetId, assigneeType, assigneeId) { 'AssetAssignments.add'(assetId, assigneeType, assigneeId) {
check(assigneeId, String); // check(assigneeId, String);
check(assigneeType, String); // check(assigneeType, String);
check(assetId, String); // check(assetId, String);
//
if(assigneeType !== 'Student' && assigneeType !== 'Staff') { // if(assigneeType !== 'Student' && assigneeType !== 'Staff') {
// Should never happen. // // Should never happen.
console.error("Error: Received incorrect assignee type in adding an assignment."); // console.error("Error: Received incorrect assignee type in adding an assignment.");
console.error(assigneeType); // console.error(assigneeType);
} // }
else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { // else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
AssetAssignments.insert({assetId, assigneeType, assigneeId}); // AssetAssignments.insert({assetId, assigneeType, assigneeId});
} // }
}, },
'AssetAssignments.remove'(_id) { 'AssetAssignments.remove'(_id) {
check(_id, String); // check(_id, String);
//
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { // if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
//TODO: Need to first verify there are no checked out assets to the staff member. // //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 { Roles } from 'meteor/alanning:roles';
//import SimpleSchema from "simpl-schema"; //import SimpleSchema from "simpl-schema";
import {AssetTypes} from "./asset-types"; import {AssetTypes} from "./asset-types";
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
import {AssetAssignments} from "/imports/api/asset-assignments"; import {AssetAssignments} from "/imports/api/asset-assignments";
// console.log("Setting Up Assets...") // console.log("Setting Up Assets...")

View File

@@ -4,7 +4,6 @@ import { Roles } from 'meteor/alanning:roles';
import {check} from "meteor/check"; import {check} from "meteor/check";
import {Sites} from "/imports/api/sites"; import {Sites} from "/imports/api/sites";
import {parse} from "csv-parse"; import {parse} from "csv-parse";
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
// console.log("Setting Up Staff...") // console.log("Setting Up Staff...")
@@ -15,15 +14,6 @@ if (Meteor.isServer) {
Meteor.publish('staff', function(siteId) { Meteor.publish('staff', function(siteId) {
return Staff.find({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({ Meteor.methods({
'staff.add'(firstName, lastName, email, siteId) { 'staff.add'(firstName, lastName, email, siteId) {

View File

@@ -4,7 +4,6 @@ import { check } from 'meteor/check';
import {Sites} from "./sites"; import {Sites} from "./sites";
import { Roles } from 'meteor/alanning:roles'; import { Roles } from 'meteor/alanning:roles';
import {parse} from 'csv-parse'; import {parse} from 'csv-parse';
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
// console.log("Setting Up Students...") // console.log("Setting Up Students...")
@@ -17,15 +16,6 @@ if (Meteor.isServer) {
Meteor.publish('students', function(siteId) { Meteor.publish('students', function(siteId) {
return Students.find({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({ Meteor.methods({
'students.getPossibleGrades'() { 'students.getPossibleGrades'() {