From c56ac1c192c347fc2bc5f52ccd9838be58514cd2 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 19 Jul 2022 13:35:17 +0200 Subject: [PATCH] feat: add log --- db/changes/10480-june/00-aclShelvingLog.sql | 3 +++ modules/shelving/back/model-config.json | 3 +++ .../{shelvingLog.json => shelving-log.json} | 22 ++++++++++++++----- modules/shelving/back/models/shelving.json | 6 ++++- modules/shelving/front/index.js | 1 + modules/shelving/front/log/index.html | 2 +- 6 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 db/changes/10480-june/00-aclShelvingLog.sql rename modules/shelving/back/models/{shelvingLog.json => shelving-log.json} (75%) diff --git a/db/changes/10480-june/00-aclShelvingLog.sql b/db/changes/10480-june/00-aclShelvingLog.sql new file mode 100644 index 000000000..dc75142d1 --- /dev/null +++ b/db/changes/10480-june/00-aclShelvingLog.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) + VALUES + ('ShelvingLog','*','READ','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/modules/shelving/back/model-config.json b/modules/shelving/back/model-config.json index ff4164b31..b5619d8c5 100644 --- a/modules/shelving/back/model-config.json +++ b/modules/shelving/back/model-config.json @@ -4,5 +4,8 @@ }, "Shelving": { "dataSource": "vn" + }, + "ShelvingLog": { + "dataSource": "vn" } } diff --git a/modules/shelving/back/models/shelvingLog.json b/modules/shelving/back/models/shelving-log.json similarity index 75% rename from modules/shelving/back/models/shelvingLog.json rename to modules/shelving/back/models/shelving-log.json index 61eb0813f..fd30d8be8 100644 --- a/modules/shelving/back/models/shelvingLog.json +++ b/modules/shelving/back/models/shelving-log.json @@ -8,20 +8,20 @@ }, "properties": { "id": { - "type": "number", "id": true, - "description": "Identifier" + "type": "number", + "forceId": false }, "originFk": { "type": "string", "required": true }, "userFk": { - "type": "number", - "required": true + "type": "number" }, "action": { - "type": "string" + "type": "string", + "required": true }, "creationDate": { "type": "date" @@ -44,5 +44,15 @@ "changedModelValue": { "type": "string" } - } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + }, + "scope": { + "order": ["creationDate DESC", "id DESC"] + } } diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json index c7fcb2560..508ac428f 100644 --- a/modules/shelving/back/models/shelving.json +++ b/modules/shelving/back/models/shelving.json @@ -1,6 +1,10 @@ { "name": "Shelving", - "base": "VnModel", + "base": "Loggable", + "log": { + "model": "ShelvingLog", + "showField": "id" + }, "options": { "mysql": { "table": "shelving" diff --git a/modules/shelving/front/index.js b/modules/shelving/front/index.js index df26602fc..2ad9bc1b9 100644 --- a/modules/shelving/front/index.js +++ b/modules/shelving/front/index.js @@ -8,3 +8,4 @@ import './index/'; import './main'; import './search-panel'; import './summary'; +import './log'; diff --git a/modules/shelving/front/log/index.html b/modules/shelving/front/log/index.html index e11d39a99..6ea349316 100644 --- a/modules/shelving/front/log/index.html +++ b/modules/shelving/front/log/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file