bigbluebutton-Github/bigbluebutton-html5/imports/api/1.1/breakouts/server/handlers/updateTimeRemaining.js
2017-06-19 08:57:32 -03:00

41 lines
850 B
JavaScript

import Breakouts from '/imports/api/1.1/breakouts';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function handleUpdateTimeRemaining({ payload }) {
const {
meetingId,
timeRemaining,
} = payload;
check(meetingId, String);
check(timeRemaining, Number);
const selector = {
parentMeetingId: meetingId,
};
const modifier = {
$set: {
timeRemaining,
},
};
const options = {
multi: true,
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Updating breakouts: ${err}`);
}
if (numChanged) {
return Logger.info('Updated breakout time remaining for breakouts ' +
`where parentMeetingId=${meetingId}`);
}
};
return Breakouts.update(selector, modifier, options, cb);
}