publications.js
543 Bytes
import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check'
import { Orgs } from '/imports/collections/orgs/index';
import { Users } from '/imports/collections/users/index';
import { Staffs } from '/imports/collections/staff/index';
Meteor.publish('staff.forMyOrg', function () {
const user = Users.findOne({_id: this.userId});
if(!user) return [];
return Staffs.find({orgId: user.orgId});
});