bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/removeMeeting.js

44 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-10-22 00:27:47 +08:00
import { check } from 'meteor/check';
import Meetings from '/imports/api/meetings';
import Logger from '/imports/startup/server/logger';
import { clearUsersCollection } from '/imports/api/users/server/modifiers/clearUsersCollection';
import clearChats from '/imports/api/chat/server/modifiers/clearChats';
import { clearShapesCollection } from '/imports/api/shapes/server/modifiers/clearShapesCollection';
import { clearSlidesCollection } from '/imports/api/slides/server/modifiers/clearSlidesCollection';
import { clearPollCollection } from '/imports/api/polls/server/modifiers/clearPollCollection';
import { clearCursorCollection } from '/imports/api/cursor/server/modifiers/clearCursorCollection';
import { clearCaptionsCollection }
from '/imports/api/captions/server/modifiers/clearCaptionsCollection';
import { clearPresentationsCollection }
from '/imports/api/presentations/server/modifiers/clearPresentationsCollection';
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) {
clearCaptionsCollection(meetingId);
clearChats(meetingId);
clearCursorCollection(meetingId);
clearPollCollection(meetingId);
clearPresentationsCollection(meetingId);
clearShapesCollection(meetingId);
clearSlidesCollection(meetingId);
clearUsersCollection(meetingId);
return Logger.info(`Removed meeting id=${meetingId}`);
}
};
return Meetings.remove(selector, cb);
};