2022-05-04 20:40:56 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
import AnnotationsStreamer from '/imports/api/annotations/server/streamer';
|
|
|
|
import removeAnnotation from '../modifiers/removeAnnotation';
|
|
|
|
|
2023-03-08 21:32:24 +08:00
|
|
|
export default async function handleWhiteboardDelete({ body }, meetingId) {
|
|
|
|
const { whiteboardId } = body;
|
2022-05-04 20:40:56 +08:00
|
|
|
const shapesIds = body.annotationsIds;
|
|
|
|
|
|
|
|
check(whiteboardId, String);
|
|
|
|
check(shapesIds, Array);
|
2023-03-08 21:32:24 +08:00
|
|
|
|
|
|
|
const result = await Promise.all(shapesIds.map(async (shapeId) => {
|
2022-05-04 20:40:56 +08:00
|
|
|
AnnotationsStreamer(meetingId).emit('removed', { meetingId, whiteboardId, shapeId });
|
2023-03-08 21:32:24 +08:00
|
|
|
await removeAnnotation(meetingId, whiteboardId, shapeId);
|
|
|
|
}));
|
|
|
|
return result;
|
2022-05-04 20:40:56 +08:00
|
|
|
}
|