2018-04-06 05:04:27 +08:00
|
|
|
import { check } from 'meteor/check';
|
2018-04-06 06:00:52 +08:00
|
|
|
import PresentationPods from '/imports/api/presentation-pods';
|
2018-04-06 05:04:27 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default function setPresenterInPod(meetingId, podId, nextPresenterId) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(podId, String);
|
|
|
|
check(nextPresenterId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
podId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
currentPresenterId: nextPresenterId,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
const { numberAffected } = PresentationPods.upsert(selector, modifier);
|
2018-04-06 05:04:27 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
2018-04-06 05:04:27 +08:00
|
|
|
Logger.info(`Set a new presenter in pod id=${podId} meeting=${meetingId}`);
|
|
|
|
}
|
2020-11-23 21:13:46 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Setting a presenter in pod: ${err}`);
|
|
|
|
}
|
2018-04-06 05:04:27 +08:00
|
|
|
}
|