From 8d0b3efa113a3309ec22f389c95131c9792aa4a2 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 14 Aug 2023 09:39:40 +0200 Subject: [PATCH 1/5] refs #4815 feat:DeviceLog Model --- db/changes/233401/01-deviceLog_acl.sql | 6 ++++ modules/worker/back/model-config.json | 3 ++ modules/worker/back/models/device-log.json | 40 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 db/changes/233401/01-deviceLog_acl.sql create mode 100644 modules/worker/back/models/device-log.json diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql new file mode 100644 index 000000000..dd8bc936b --- /dev/null +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -0,0 +1,6 @@ + +ALTER TABLE vn.deviceLog ADD serialNumber varchar(45) DEFAULT NULL NULL; + +INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) +VALUES( 'DeviceLog', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index 60ec273a5..b261f895e 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -23,6 +23,9 @@ "Device": { "dataSource": "vn" }, + "DeviceLog": { + "dataSource": "vn" + }, "DeviceProduction": { "dataSource": "vn" }, diff --git a/modules/worker/back/models/device-log.json b/modules/worker/back/models/device-log.json new file mode 100644 index 000000000..9278b9038 --- /dev/null +++ b/modules/worker/back/models/device-log.json @@ -0,0 +1,40 @@ +{ + "name": "DeviceLog", + "base": "VnModel", + "options": { + "mysql": { + "table": "deviceLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "android_id": { + "type": "string" + }, + "userFk": { + "type": "number" + }, + "created": { + "type": "date" + }, + "nameApp": { + "type": "string" + }, + "versionApp": { + "type": "string" + }, + "deviceProductionFk": { + "type": "number" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "userFk" + } + } +} From e7cd052199f1df73342d47631c8fd8ea5c4e2110 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 31 Aug 2023 13:49:00 +0200 Subject: [PATCH 2/5] refs #6132 add messageError --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 46b48e2ea..5d2b7ab03 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -185,5 +185,6 @@ "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist." + "The ticket doesn't exist.": "The ticket doesn't exist.", + "Ticket without Route": "Ticket without route" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 195b683ad..ccd63e0ff 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -315,5 +315,6 @@ "This ticket is not editable.": "Este ticket no es editable.", "The ticket doesn't exist.": "No existe el ticket.", "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "Ticket without Route": "Ticket sin ruta" } From 7d8828e6043a8e97ef28108907c7485b2fdcb822 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 31 Aug 2023 13:50:31 +0200 Subject: [PATCH 3/5] refs #6132 fix: saveSign without route --- modules/ticket/back/methods/ticket/saveSign.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 55d2e3281..9888328e7 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -93,6 +93,8 @@ module.exports = Self => { }, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); + if (ticket.route() === null) + throw new UserError('Ticket without route'); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, From 281ae0eb0477e8c55a84f58024e4fa038b47bdc7 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 1 Sep 2023 07:21:15 +0200 Subject: [PATCH 4/5] refs #4815 feat:DeviceLogModel --- db/changes/233401/01-deviceLog_acl.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql index dd8bc936b..7b7becf58 100644 --- a/db/changes/233401/01-deviceLog_acl.sql +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -1,6 +1,6 @@ -ALTER TABLE vn.deviceLog ADD serialNumber varchar(45) DEFAULT NULL NULL; +ALTER TABLE `vn`.`deviceLog`ADD serialNumber varchar(45) DEFAULT NULL NULL; INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) -VALUES( 'DeviceLog', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); +VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee'); From 473e710d1b825f229ee940e36625794323dcfc22 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 1 Sep 2023 07:22:15 +0200 Subject: [PATCH 5/5] refs #4815 feat:DeviceLogModel --- db/changes/233401/01-deviceLog_acl.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/233401/01-deviceLog_acl.sql b/db/changes/233401/01-deviceLog_acl.sql index 7b7becf58..ebe3f8ed5 100644 --- a/db/changes/233401/01-deviceLog_acl.sql +++ b/db/changes/233401/01-deviceLog_acl.sql @@ -1,5 +1,5 @@ -ALTER TABLE `vn`.`deviceLog`ADD serialNumber varchar(45) DEFAULT NULL NULL; +ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL; INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId) VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');