Merged the AssetAssignment collection with the Asset collection; Updated views for assigning assets; Added view to find asset assignments by assetId.

This commit is contained in:
2022-08-14 17:07:14 -07:00
parent f3b1b38e82
commit cf51200393
13 changed files with 3897 additions and 53 deletions

View File

@@ -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 { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
export const Students = new Mongo.Collection('students');
@@ -14,6 +15,15 @@ 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'() {