2017-06-29 04:37:45 +08:00
|
|
|
import Polls from '/imports/api/2.0/polls';
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2017-07-07 19:23:31 +08:00
|
|
|
const cb = (err) => {
|
2017-06-29 04:37:45 +08:00
|
|
|
if (err) {
|
2017-06-30 22:26:19 +08:00
|
|
|
return Logger.error(`Removing Poll2x from collection: ${err}`);
|
2017-06-29 04:37:45 +08:00
|
|
|
}
|
|
|
|
|
2017-07-07 19:23:31 +08:00
|
|
|
return Logger.info(`Removed Poll2x id=${pollId}`);
|
2017-06-29 04:37:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return Polls.remove(selector, cb);
|
|
|
|
}
|