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