Merge pull request 'feat(user): added userConfig.darkMode relation towards account.user' (#943) from 3904-user_dark_mode into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #943
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2022-04-20 14:30:32 +00:00
commit bd0164dd4e
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';