2016-10-21 21:21:09 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import Polls from '/imports/api/polls';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import { logger } from '/imports/startup/server/logger';
|
2017-06-01 01:54:43 +08:00
|
|
|
import mapToAcl from '/imports/startup/mapToAcl';
|
2016-10-21 21:21:09 +08:00
|
|
|
|
|
|
|
|
2017-06-01 01:54:43 +08:00
|
|
|
Meteor.publish('polls', function() {
|
|
|
|
polls = polls.bind(this);
|
2017-06-01 21:12:11 +08:00
|
|
|
return mapToAcl('polls', polls)(arguments);
|
2017-06-01 01:54:43 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
function polls(credentials) {
|
2016-10-21 21:21:09 +08:00
|
|
|
const { meetingId, requesterUserId, requesterToken } = credentials;
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(requesterToken, String);
|
|
|
|
|
2016-10-22 02:56:42 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId: meetingId,
|
|
|
|
users: requesterUserId,
|
|
|
|
};
|
|
|
|
|
2016-11-25 03:22:04 +08:00
|
|
|
let options = {};
|
2016-10-22 02:56:42 +08:00
|
|
|
|
|
|
|
return Polls.find(selector, options);
|
2017-06-01 01:54:43 +08:00
|
|
|
};
|