bigbluebutton-Github/bigbluebutton-html5/imports/api/local-settings/server/modifiers/setChangedLocalSettings.js
2019-07-29 11:17:38 -03:00

33 lines
686 B
JavaScript

import { check } from 'meteor/check';
import LocalSettings from '/imports/api/local-settings';
import Logger from '/imports/startup/server/logger';
export default function setChangedLocalSettings(meetingId, userId, settings) {
check(meetingId, String);
check(userId, String);
check(settings, Object);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
settings,
},
};
const cb = (err, numChanged) => {
if (err) {
Logger.error(`${err}`);
}
if (numChanged) {
Logger.info(`Updated settings for user ${userId} on meeting ${meetingId}`);
}
};
return LocalSettings.upsert(selector, modifier, cb);
}