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';
|
|
|
|
|
2023-03-08 21:32:24 +08:00
|
|
|
export default async 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
|
|
|
};
|
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-08 21:32:24 +08:00
|
|
|
const numberAffected = await Annotations.removeAsync(selector);
|
2016-11-19 01:35:28 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Removed annotation id=${shapeId} whiteboard=${whiteboardId}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing annotation from collection: ${err}`);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|