27 lines
617 B
JavaScript
Executable File
27 lines
617 B
JavaScript
Executable File
import Logger from '/imports/startup/server/logger';
|
|
import Users from '/imports/api/users';
|
|
|
|
export default function changePresenter(presenter, userId, meetingId, changedBy) {
|
|
const selector = {
|
|
meetingId,
|
|
userId,
|
|
};
|
|
|
|
const modifier = {
|
|
$set: {
|
|
presenter,
|
|
},
|
|
};
|
|
|
|
try {
|
|
const numberAffected = Users.update(selector, modifier);
|
|
|
|
if (numberAffected) {
|
|
Logger.info(`Changed presenter=${presenter} id=${userId} meeting=${meetingId}`
|
|
+ `${changedBy ? ` changedBy=${changedBy}` : ''}`);
|
|
}
|
|
} catch (err) {
|
|
Logger.error(`Change presenter error: ${err}`);
|
|
}
|
|
}
|