bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/modifiers/addAnnotation.js

23 lines
796 B
JavaScript
Raw Normal View History

2016-11-19 01:35:28 +08:00
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Annotations from '/imports/api/annotations';
import addAnnotationQuery from '/imports/api/annotations/addAnnotation';
export default async function addAnnotation(meetingId, whiteboardId, userId, annotation) {
check(meetingId, String);
check(whiteboardId, String);
check(annotation, Object);
const query = await addAnnotationQuery(meetingId, whiteboardId, userId, annotation, Annotations);
2016-11-19 01:35:28 +08:00
try {
const { insertedId } = await Annotations.upsertAsync(query.selector, query.modifier);
2018-04-24 21:59:13 +08:00
if (insertedId) {
Logger.info(`Added annotation id=${annotation.id} whiteboard=${whiteboardId}`);
}
} catch (err) {
Logger.error(`Adding annotation to collection: ${err}`);
}
}