2018-09-14 02:09:30 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import addUserSetting from '/imports/api/users-settings/server/modifiers/addUserSetting';
|
|
|
|
|
2018-09-18 01:05:39 +08:00
|
|
|
export default function addUserSettings(credentials, meetingId, userId, settings) {
|
2018-09-14 02:09:30 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
2018-09-18 01:05:39 +08:00
|
|
|
check(settings, Object);
|
2018-09-14 02:09:30 +08:00
|
|
|
|
2018-09-18 01:05:39 +08:00
|
|
|
const settingsAdded = [];
|
|
|
|
|
|
|
|
Object.entries(settings).forEach((el) => {
|
|
|
|
const setting = el[0];
|
|
|
|
const value = el[1];
|
|
|
|
settingsAdded.push(addUserSetting(meetingId, userId, setting, value));
|
|
|
|
});
|
|
|
|
|
|
|
|
return settingsAdded;
|
2018-09-14 02:09:30 +08:00
|
|
|
}
|