Skip to content
Snippets Groups Projects
Commit 65cf1d6c authored by Oleksandr Zhurbenko's avatar Oleksandr Zhurbenko
Browse files

Handle RemovePresentationPod

parent e5a4bd09
No related branches found
No related tags found
Loading
import { check } from 'meteor/check';
import removePresentationPod from '../modifiers/removePresentationPod';
export default function handleRemovePresentationPod({ body }, meetingId) {
check(body, Object);
check(meetingId, String);
const { podId } = body;
check(podId, String);
removePresentationPod(meetingId, podId);
}
import { check } from 'meteor/check';
import PresentationPods from '/imports/api/presentations';
import Logger from '/imports/startup/server/logger';
import clearPresentations from '/imports/api/presentations/server/modifiers/clearPresentations';
export default function removePresentationPod(meetingId, podId) {
check(meetingId, String);
check(podId, String);
const selector = {
meetingId,
podId,
};
const cb = (err) => {
if (err) {
Logger.error(`Removing presentation pod from collection: ${err}`);
return;
}
if (podId) {
Logger.info(`Removed presentation pod id=${podId} meeting=${meetingId}`);
clearPresentations(meetingId, podId);
}
};
return PresentationPods.remove(selector, cb);
}
import Presentations from '/imports/api/presentations';
import Logger from '/imports/startup/server/logger';
export default function clearPresentations(meetingId) {
if (meetingId) {
return Presentations.remove({ meetingId },
Logger.info(`Cleared Presentations (${meetingId})`));
export default function clearPresentations(meetingId, podId) {
// clearing presentations for 1 pod
if (meetingId && podId) {
return Presentations.remove(
{ meetingId, podId },
Logger.info(`Cleared Presentations for the podId=${podId} and meetingId=${meetingId}`),
);
// clearing presentations for the whole meeting
} else if (meetingId) {
return Presentations.remove(
{ meetingId },
Logger.info(`Cleared Presentations for the meetingId=${meetingId}`),
);
}
// clearing presentations for the whole server
return Presentations.remove({}, Logger.info('Cleared Presentations (all)'));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment