Added dark mode
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
Schemas.UserProfile = schema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
Schemas.User = schema({
|
||||
const userSchema = schema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
profile: {
|
||||
type: Schemas.UserProfile,
|
||||
optional: true,
|
||||
},
|
||||
emails: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
@@ -44,11 +36,6 @@ Schemas.User = schema({
|
||||
optional: true,
|
||||
blackbox: true,
|
||||
},
|
||||
roles: {
|
||||
type: Object,
|
||||
optional: true,
|
||||
blackbox: true,
|
||||
},
|
||||
roles: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
@@ -66,11 +53,15 @@ Schemas.User = schema({
|
||||
index: 1,
|
||||
optional: true,
|
||||
},
|
||||
darkMode: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.users.attachSchema(Schemas.User);
|
||||
Meteor.users.attachSchema(userSchema);
|
||||
|
||||
Meteor.users.gnerateApiKey = new ValidatedMethod({
|
||||
Meteor.users.generateApiKey = new ValidatedMethod({
|
||||
name: "Users.methods.generateApiKey",
|
||||
validate: null,
|
||||
run(){
|
||||
@@ -83,6 +74,17 @@ Meteor.users.gnerateApiKey = new ValidatedMethod({
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.users.setDarkMode = new ValidatedMethod({
|
||||
name: "Users.methods.setDarkMode",
|
||||
validate: new SimpleSchema({
|
||||
darkMode: { type: Boolean },
|
||||
}).validator(),
|
||||
run({darkMode}){
|
||||
if (!this.userId) return;
|
||||
Meteor.users.update(this.userId, {$set: {darkMode}});
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.users.sendVerificationEmail = new ValidatedMethod({
|
||||
name: "Users.methods.sendVerificationEmail",
|
||||
validate: schema({
|
||||
|
||||
Reference in New Issue
Block a user