Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created June 18, 2019 05:42
Show Gist options
  • Save tkssharma/f222f1d4bcce3ae480c4a1d8257436c1 to your computer and use it in GitHub Desktop.
Save tkssharma/f222f1d4bcce3ae480c4a1d8257436c1 to your computer and use it in GitHub Desktop.
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
export const Teams = new Mongo.Collection('teams');
if (Meteor.isServer) {
// This code only runs on the server
Meteor.publish('teams', function groupPublication() {
return Teams.find();
});
}
Meteor.methods({
'teams.insert'({name,description}) {
Teams.insert({
name,
description,
createdAt: new Date(),
updatedAt: new Date(),
owner: this.userId,
members : [this.userId]
});
},
'teams.removeTeam'(id) {
Teams.remove(id);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment