bigbluebutton-Github/bigbluebutton-html5/imports/api/auth-token-validation/server/modifiers/upsertValidationState.js

28 lines
758 B
JavaScript
Raw Normal View History

import Logger from '/imports/startup/server/logger';
import AuthTokenValidation from '/imports/api/auth-token-validation';
export default function upsertValidationState(meetingId, userId, validationStatus, connectionId) {
const selector = {
meetingId, userId, connectionId,
};
const modifier = {
$set: {
meetingId,
userId,
connectionId,
validationStatus,
},
};
const cb = (err, numChanged) => {
if (err) {
Logger.error(`Could not upsert to collection AuthTokenValidation: ${err}`);
return;
}
if (numChanged) {
Logger.info(`Upserted ${JSON.stringify(selector)} ${validationStatus} in AuthTokenValidation`);
}
};
return AuthTokenValidation.upsert(selector, modifier, cb);
}