2019-06-29 04:52:19 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = Users.update(selector, modifier);
|
2019-06-29 04:52:19 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Changed presenter=${presenter} id=${userId} meeting=${meetingId}`
|
|
|
|
+ `${changedBy ? ` changedBy=${changedBy}` : ''}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
2021-06-22 02:16:01 +08:00
|
|
|
Logger.error(`Change presenter error: ${err}`);
|
2019-12-19 05:40:04 +08:00
|
|
|
}
|
2019-06-29 04:52:19 +08:00
|
|
|
}
|