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:
@@ -4,7 +4,7 @@ import { Roles } from 'meteor/alanning:roles';
|
||||
import {check} from "meteor/check";
|
||||
import {Sites} from "/imports/api/sites";
|
||||
import {parse} from "csv-parse";
|
||||
import {Students} from "/imports/api/students";
|
||||
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
|
||||
|
||||
export const Staff = new Mongo.Collection('staff');
|
||||
|
||||
@@ -13,6 +13,15 @@ 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) {
|
||||
|
||||
Reference in New Issue
Block a user