bigbluebutton-Github/bigbluebutton-html5/imports/api/screenshare/server/modifiers/addScreenshare.js

30 lines
667 B
JavaScript
Raw Normal View History

2017-07-14 22:18:46 +08:00
import { check } from 'meteor/check';
import flat from 'flat';
import Logger from '/imports/startup/server/logger';
import Screenshare from '/imports/api/screenshare';
2017-07-14 22:18:46 +08:00
export default function addScreenshare(meetingId, body) {
2017-07-14 22:18:46 +08:00
check(meetingId, String);
const selector = {
meetingId,
};
const modifier = {
$set: {
meetingId,
screenshare: flat(body),
2017-07-14 22:18:46 +08:00
},
};
try {
const { numberAffected } = Screenshare.upsert(selector, modifier);
2017-07-14 22:18:46 +08:00
if (numberAffected) {
Logger.info(`Upserted screenshare id=${body.screenshareConf}`);
}
} catch (err) {
return Logger.error(`Adding screenshare to collection: ${err}`);
}
2017-07-14 22:18:46 +08:00
}