diff --git a/back/methods/account/acl.js b/back/methods/account/acl.js index c1dcdc11b..bc1990e1d 100644 --- a/back/methods/account/acl.js +++ b/back/methods/account/acl.js @@ -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({ diff --git a/back/models/account.json b/back/models/account.json index b59cf39c2..9150bc1a7 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -71,6 +71,11 @@ "type": "hasOne", "model": "Worker", "foreignKey": "userFk" + }, + "userConfig": { + "type": "hasOne", + "model": "UserConfig", + "foreignKey": "userFk" } }, "acls": [ diff --git a/back/models/user-config.json b/back/models/user-config.json index 336f26f63..8e4684713 100644 --- a/back/models/user-config.json +++ b/back/models/user-config.json @@ -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": { diff --git a/db/changes/10451-april/00-account_user.sql b/db/changes/10451-april/00-account_user.sql new file mode 100644 index 000000000..2988c310e --- /dev/null +++ b/db/changes/10451-april/00-account_user.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`userConfig` ADD darkMode tinyint(1) DEFAULT 1 NOT NULL COMMENT 'Salix interface dark mode'; \ No newline at end of file