feat(user): added userConfig.darkMode relation towards account.user
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-04-20 10:25:01 +02:00
parent 91f111f609
commit 8efcb6233f
4 changed files with 21 additions and 6 deletions

View File

@ -23,7 +23,13 @@ module.exports = Self => {
let models = Self.app.models;
let user = await models.Account.findById(userId, {
fields: ['id', 'name', 'nickname', 'email']
fields: ['id', 'name', 'nickname', 'email', 'lang'],
include: {
relation: 'userConfig',
scope: {
fields: ['darkMode']
}
}
});
let roles = await models.RoleMapping.find({

View File

@ -71,6 +71,11 @@
"type": "hasOne",
"model": "Worker",
"foreignKey": "userFk"
},
"userConfig": {
"type": "hasOne",
"model": "UserConfig",
"foreignKey": "userFk"
}
},
"acls": [

View File

@ -9,20 +9,23 @@
"properties": {
"userFk": {
"id": true,
"type": "Number",
"type": "number",
"required": true
},
"warehouseFk": {
"type": "Number"
"type": "number"
},
"companyFk": {
"type": "Number"
"type": "number"
},
"created": {
"type": "Date"
"type": "date"
},
"updated": {
"type": "Date"
"type": "date"
},
"darkMode": {
"type": "boolean"
}
},
"relations": {

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`userConfig` ADD darkMode tinyint(1) DEFAULT 1 NOT NULL COMMENT 'Salix interface dark mode';