2021-11-29 21:44:14 +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 changePin(meetingId, userId, pin, changedBy) {
|
2021-11-29 21:44:14 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
pin,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
2023-03-15 21:18:31 +08:00
|
|
|
const numberAffected = await Users.updateAsync(selector, modifier);
|
2021-11-29 21:44:14 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Change pin=${pin} id=${userId} meeting=${meetingId} changedBy=${changedBy}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Change pin error: ${err}`);
|
|
|
|
}
|
|
|
|
}
|