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 models = Self.app.models;
let user = await models.Account.findById(userId, { 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({ let roles = await models.RoleMapping.find({

View File

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

View File

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

View File

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