Skip to content

Commit

Permalink
Step 3.24: Validate new message method params
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Dotan Simha committed Nov 23, 2016
1 parent fa664f0 commit c3acd7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/methods.js
Expand Up @@ -3,6 +3,12 @@ import { Chats, Messages } from '../lib/collections';

Meteor.methods({
newMessage(message) {
check(message, {
type: String,
text: String,
chatId: String
});

message.timestamp = new Date();

const messageId = Messages.insert(message);
Expand Down

0 comments on commit c3acd7a

Please sign in to comment.