2021-11-29 21:44:14 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import VideoStreams from '/imports/api/video-streams';
|
|
|
|
|
2023-03-20 20:23:39 +08:00
|
|
|
export default async function changePin(meetingId, userId, pin) {
|
2021-11-29 21:44:14 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
pin,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
2023-03-20 20:23:39 +08:00
|
|
|
const numberAffected = await VideoStreams.updateAsync(selector, modifier, { multi: true });
|
2021-11-29 21:44:14 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Updated user streams pinned userId=${userId} pinned=${pin}`);
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
return Logger.error(`Error updating stream pinned status: ${error}`);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|