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
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = Polls.remove(selector);
|
2016-10-22 01:11:28 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Removed Poll id=${id}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing Poll from collection: ${err}`);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|