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';
|
|
|
|
|
2017-07-25 20:26:45 +08:00
|
|
|
export default function removePoll(meetingId, id) {
|
2017-06-29 04:37:45 +08:00
|
|
|
check(meetingId, String);
|
2017-07-25 20:26:45 +08:00
|
|
|
check(id, String);
|
2017-06-29 04:37:45 +08:00
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
2017-07-25 20:26:45 +08:00
|
|
|
id,
|
2017-06-29 04:37:45 +08:00
|
|
|
};
|
|
|
|
|
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-25 20:26:45 +08:00
|
|
|
return Logger.info(`Removed Poll2x id=${id}`);
|
2017-06-29 04:37:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return Polls.remove(selector, cb);
|
|
|
|
}
|