Skip to content

Commit

Permalink
Step 7.14: Add publication for Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored and DAB0mB committed Dec 17, 2016
1 parent 78259ae commit 5f2ad2d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/imports/publications/messages.publication.ts
@@ -0,0 +1,12 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';

import { Messages } from '../../../both/collections/messages.collection';
import { Message } from '../../../both/models/message.model';

Meteor.publish('messages', function(chatId: string): Mongo.Cursor<Message> {
if (!this.userId) return;
if (!chatId) return;

return Messages.collection.find({chatId});
});

0 comments on commit 5f2ad2d

Please sign in to comment.