Permalink
Browse files

Step 14.1: Add uninvited users publication

  • Loading branch information...
1 parent a2455dc commit 0107f1384c9eb99bb9838621cea4f9a57d212c46 @kamilkisiela kamilkisiela committed with DAB0mB Sep 23, 2016
Showing with 18 additions and 0 deletions.
  1. +18 −0 server/imports/publications/users.ts
@@ -0,0 +1,18 @@
+import { Meteor } from 'meteor/meteor';
+
+import { Parties } from '../../../both/collections/parties.collection';
+
+Meteor.publish('uninvited', function (partyId: string) {
+ const party = Parties.findOne(partyId);
+
+ if (!party) {
+ throw new Meteor.Error('404', 'No such party!');
+ }
+
+ return Meteor.users.find({
+ _id: {
+ $nin: party.invited || [],
+ $ne: this.userId
+ }
+ });
+});

0 comments on commit 0107f13

Please sign in to comment.