29 lines
801 B
JavaScript
29 lines
801 B
JavaScript
import Logger from '/imports/startup/server/logger';
|
|
import AuthTokenValidation from '/imports/api/auth-token-validation';
|
|
|
|
export default function upsertValidationState(meetingId, userId, validationStatus, connectionId, reason = null) {
|
|
const selector = {
|
|
meetingId, userId, connectionId,
|
|
};
|
|
const modifier = {
|
|
$set: {
|
|
meetingId,
|
|
userId,
|
|
connectionId,
|
|
validationStatus,
|
|
updatedAt: new Date().getTime(),
|
|
reason,
|
|
},
|
|
};
|
|
|
|
try {
|
|
const { numberAffected } = AuthTokenValidation.upsert(selector, modifier);
|
|
|
|
if (numberAffected) {
|
|
Logger.info(`Upserted ${JSON.stringify(selector)} ${validationStatus} in AuthTokenValidation`);
|
|
}
|
|
} catch (err) {
|
|
Logger.error(`Could not upsert to collection AuthTokenValidation: ${err}`);
|
|
}
|
|
}
|