2016-11-19 01:35:28 +08:00
|
|
|
import { check } from 'meteor/check';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Annotations from '/imports/api/annotations';
|
2016-11-19 01:35:28 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
export default function removeAnnotation(meetingId, whiteboardId, shapeId) {
|
2016-11-19 01:35:28 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(whiteboardId, String);
|
|
|
|
check(shapeId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
whiteboardId,
|
2017-10-12 08:52:57 +08:00
|
|
|
id: shapeId,
|
2016-11-19 01:35:28 +08:00
|
|
|
};
|
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
const cb = (err) => {
|
2016-11-19 01:35:28 +08:00
|
|
|
if (err) {
|
2017-10-12 08:52:57 +08:00
|
|
|
return Logger.error(`Removing annotation from collection: ${err}`);
|
2016-11-19 01:35:28 +08:00
|
|
|
}
|
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
return Logger.info(`Removed annotation id=${shapeId} whiteboard=${whiteboardId}`);
|
2016-11-19 01:35:28 +08:00
|
|
|
};
|
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
return Annotations.remove(selector, cb);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|