9e1c8a4fb7
Can't afford WebStorm :-(
37 lines
845 B
JavaScript
37 lines
845 B
JavaScript
import Annotations from '/imports/api/2.0/annotations';
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
export default function clearAnnotations(meetingId, whiteboardId, userId) {
|
|
const selector = {};
|
|
|
|
if (meetingId) {
|
|
selector.meetingId = meetingId;
|
|
}
|
|
|
|
if (whiteboardId) {
|
|
selector.whiteboardId = whiteboardId;
|
|
}
|
|
|
|
if (userId) {
|
|
selector.userId = userId;
|
|
}
|
|
|
|
const cb = (err) => {
|
|
if (err) {
|
|
return Logger.error(`Removing Shapes2x from collection: ${err}`);
|
|
}
|
|
|
|
if (!meetingId) {
|
|
return Logger.info('Cleared Annotations (all)');
|
|
}
|
|
|
|
if (userId) {
|
|
return Logger.info(`Removed Shapes2x for userId=${userId} where whiteboard=${whiteboardId}`);
|
|
}
|
|
|
|
return Logger.info(`Removed Shapes2x where whiteboard=${whiteboardId}`);
|
|
};
|
|
|
|
return Annotations.remove(selector, cb);
|
|
}
|