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