2016-10-22 00:27:47 +08:00
|
|
|
import { check } from 'meteor/check';
|
2017-06-19 19:57:32 +08:00
|
|
|
import Meetings from '/imports/api/1.1/meetings';
|
2016-10-22 00:27:47 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2017-06-19 19:57:32 +08:00
|
|
|
import clearUsers from '/imports/api/1.1/users/server/modifiers/clearUsers';
|
|
|
|
import clearChats from '/imports/api/1.1/chat/server/modifiers/clearChats';
|
|
|
|
import clearShapes from '/imports/api/1.1/shapes/server/modifiers/clearShapes';
|
|
|
|
import clearSlides from '/imports/api/1.1/slides/server/modifiers/clearSlides';
|
|
|
|
import clearPolls from '/imports/api/1.1/polls/server/modifiers/clearPolls';
|
|
|
|
import clearCursor from '/imports/api/1.1/cursor/server/modifiers/clearCursor';
|
|
|
|
import clearCaptions from '/imports/api/1.1/captions/server/modifiers/clearCaptions';
|
|
|
|
import clearPresentations from '/imports/api/1.1/presentations/server/modifiers/clearPresentations';
|
2016-10-22 00:27:47 +08:00
|
|
|
|
|
|
|
export default function removeMeeting(meetingId) {
|
|
|
|
check(meetingId, String);
|
|
|
|
|
|
|
|
const selector = {
|
2016-10-24 19:20:30 +08:00
|
|
|
meetingId,
|
2016-10-22 00:27:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const cb = (err, numChanged) => {
|
|
|
|
if (err) {
|
|
|
|
return Logger.error(`Removing meeting from collection: ${err}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numChanged) {
|
2017-02-10 20:25:31 +08:00
|
|
|
clearCaptions(meetingId);
|
2016-10-22 00:27:47 +08:00
|
|
|
clearChats(meetingId);
|
2016-11-19 01:35:28 +08:00
|
|
|
clearCursor(meetingId);
|
2016-11-12 03:02:46 +08:00
|
|
|
clearPresentations(meetingId);
|
2016-11-15 05:40:50 +08:00
|
|
|
clearPolls(meetingId);
|
2016-11-19 01:35:28 +08:00
|
|
|
clearShapes(meetingId);
|
2016-11-12 03:02:46 +08:00
|
|
|
clearSlides(meetingId);
|
2017-02-24 02:15:08 +08:00
|
|
|
clearUsers(meetingId);
|
2016-10-22 00:27:47 +08:00
|
|
|
|
|
|
|
return Logger.info(`Removed meeting id=${meetingId}`);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return Meetings.remove(selector, cb);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|