2019-11-20 01:49:18 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import Users from '/imports/api/users';
|
|
|
|
|
2023-03-15 21:18:31 +08:00
|
|
|
export default async function setMobile(meetingId, userId) {
|
2019-11-20 01:49:18 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
mobile: true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-02-08 20:55:38 +08:00
|
|
|
try {
|
2023-03-15 21:18:31 +08:00
|
|
|
const numberAffected = await Users.updateAsync(selector, modifier);
|
2019-11-20 01:49:18 +08:00
|
|
|
|
2021-02-08 20:55:38 +08:00
|
|
|
if (numberAffected) {
|
2019-11-20 01:49:18 +08:00
|
|
|
Logger.info(`Assigned mobile user id=${userId} meeting=${meetingId}`);
|
|
|
|
}
|
2021-02-08 20:55:38 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Assigning mobile user: ${err}`);
|
|
|
|
}
|
2019-11-20 01:49:18 +08:00
|
|
|
}
|