mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
32 lines
767 B
JavaScript
32 lines
767 B
JavaScript
|
|
import { Meteor } from 'meteor/meteor';
|
||
|
|
import { Mongo } from 'meteor/mongo';
|
||
|
|
import { check } from 'meteor/check';
|
||
|
|
|
||
|
|
export const UserConfigOptions = new Mongo.Collection('userConfigOptions');
|
||
|
|
|
||
|
|
UserConfigOptions.allow({
|
||
|
|
insert: function(userId, doc){
|
||
|
|
// if use id exists, allow insert
|
||
|
|
return !!userId;
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
Meteor.methods({
|
||
|
|
'add.darkPref' (darkPref) {
|
||
|
|
check(darkPref, Boolean);
|
||
|
|
|
||
|
|
return UserConfigOptions.insert({
|
||
|
|
darkPref: darkPref,
|
||
|
|
owner: this.userId
|
||
|
|
});
|
||
|
|
},
|
||
|
|
'edit.darkPref' (darkPref) {
|
||
|
|
check(darkPref, Boolean);
|
||
|
|
|
||
|
|
return UserConfigOptions.update({ owner: this.userId }, {
|
||
|
|
$set: {
|
||
|
|
darkPref: darkPref
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
});
|