2014-07-30 04:57:02 +08:00
|
|
|
Meteor.methods
|
2014-07-30 05:30:16 +08:00
|
|
|
addPresentationToCollection: (meetingId, presentationObject) ->
|
2014-07-30 05:33:35 +08:00
|
|
|
#check if the presentation is already in the collection
|
|
|
|
unless Meteor.Presentations.findOne({meetingId: meetingId, 'presentation.id': presentationObject.id})?
|
|
|
|
entry =
|
|
|
|
meetingId: meetingId
|
|
|
|
presentation:
|
|
|
|
id: presentationObject.id
|
|
|
|
name: presentationObject.name
|
|
|
|
current: presentationObject.current
|
2014-07-30 05:30:16 +08:00
|
|
|
|
2014-07-30 05:33:35 +08:00
|
|
|
id = Meteor.Presentations.insert(entry)
|
2014-07-31 03:35:31 +08:00
|
|
|
console.log "added presentation id =[#{id}]:#{presentationObject.id} in #{meetingId}. Presentations.size is now
|
|
|
|
#{Meteor.Presentations.find({meetingId: meetingId}).count()}"
|
|
|
|
|
|
|
|
removePresentationFromCollection: (meetingId, presentationId) ->
|
|
|
|
if meetingId? and presentationId? and Meteor.Presentations.findOne({meetingId: meetingId, "presentation.id": presentationId})?
|
|
|
|
id = Meteor.Presentations.findOne({meetingId: meetingId, "presentation.id": presentationId})
|
|
|
|
if id?
|
|
|
|
Meteor.Presentations.remove(id._id)
|
|
|
|
console.log "----removed presentation[" + presentationId + "] from " + meetingId
|