2017-06-19 19:57:32 +08:00
|
|
|
import Polls from '/imports/api/1.1/polls';
|
2016-10-22 01:11:28 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default function removePoll(meetingId, pollId) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(pollId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
'poll.id': pollId,
|
|
|
|
};
|
|
|
|
|
2016-10-22 01:42:43 +08:00
|
|
|
const cb = (err, numChanged) => {
|
|
|
|
if (err) {
|
|
|
|
return Logger.error(`Removing Poll from collection: ${err}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numChanged) {
|
|
|
|
return Logger.info(`Removed Poll id=${pollId}`);
|
|
|
|
}
|
|
|
|
};
|
2016-10-22 01:11:28 +08:00
|
|
|
|
|
|
|
return Polls.remove(selector, cb);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|