bigbluebutton-Github/bigbluebutton-html5/imports/api/connection-status/server/modifiers/updateConnectionStatus.js

33 lines
804 B
JavaScript
Raw Normal View History

2020-04-10 01:01:46 +08:00
import ConnectionStatus from '/imports/api/connection-status';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function updateConnectionStatus(meetingId, userId, level) {
check(meetingId, String);
check(userId, String);
const timestamp = new Date().getTime();
const selector = {
meetingId,
userId,
};
const modifier = {
2020-05-14 21:35:25 +08:00
meetingId,
userId,
level,
timestamp,
2020-04-10 01:01:46 +08:00
};
try {
const { numberAffected } = ConnectionStatus.upsert(selector, modifier);
2020-04-10 01:01:46 +08:00
if (numberAffected) {
Logger.verbose(`Updated connection status meetingId=${meetingId} userId=${userId} level=${level}`);
2020-05-14 21:35:25 +08:00
}
} catch (err) {
Logger.error(`Updating connection status meetingId=${meetingId} userId=${userId}: ${err}`);
}
2020-04-10 01:01:46 +08:00
}