Skip to content

Commit

Permalink
Step 9.2: Add the parties publication to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and DAB0mB committed Dec 14, 2016
1 parent 311f278 commit 17b4a9e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions imports/api/parties/publish.js
@@ -0,0 +1,31 @@
import { Meteor } from 'meteor/meteor';

import { Parties } from './collection';

if (Meteor.isServer) {
Meteor.publish('parties', function() {
const selector = {
$or: [{
// the public parties
$and: [{
public: true
}, {
public: {
$exists: true
}
}]
}, {
// when logged in user is the owner
$and: [{
owner: this.userId
}, {
owner: {
$exists: true
}
}]
}]
};

return Parties.find(selector);
});
}

0 comments on commit 17b4a9e

Please sign in to comment.