Created
June 18, 2019 05:42
-
-
Save tkssharma/f222f1d4bcce3ae480c4a1d8257436c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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