bigbluebutton-Github/bigbluebutton-html5/imports/api/captions/server/modifiers/createCaptions.js

34 lines
782 B
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import Captions from '/imports/api/captions';
import Logger from '/imports/startup/server/logger';
export default async function createCaptions(meetingId, locale, name) {
try {
check(meetingId, String);
check(locale, String);
check(name, String);
const selector = {
meetingId,
locale,
};
const modifier = {
meetingId,
locale,
name,
ownerId: '',
dictating: false,
transcript: '',
};
const { numberAffected } = await Captions.upsertAsync(selector, modifier);
if (numberAffected) {
Logger.verbose(`Created captions=${locale} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Creating captions owner to the collection: ${err}`);
}
}