From a499f7c6334e4f68656c56966a89d489a777c662 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 6 Jun 2023 13:41:42 +0200 Subject: [PATCH] refs #5630 feat: borrar expediciones de GLS --- .../methods/expedition/deleteExpeditions.js | 5 ++++ modules/ticket/back/model-config.json | 3 +++ .../ticket/back/models/gls-expedition.json | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 modules/ticket/back/models/gls-expedition.json diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index 2419d3a5e8..2f11ddefc8 100644 --- a/modules/ticket/back/methods/expedition/deleteExpeditions.js +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -35,6 +35,11 @@ module.exports = Self => { try { const promises = []; for (let expeditionId of expeditionIds) { + const glsExpedition = await models.GlsExpedition.findById(expeditionId); + if (glsExpedition) { + const barcode = glsExpedition.barcode; + } + const deletedExpedition = models.Expedition.destroyById(expeditionId, myOptions); promises.push(deletedExpedition); } diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index bee01a8756..1e9977205a 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -20,6 +20,9 @@ "ExpeditionState": { "dataSource": "vn" }, + "GlsExpedition": { + "dataSource": "vn" + }, "Packaging": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/gls-expedition.json b/modules/ticket/back/models/gls-expedition.json new file mode 100644 index 0000000000..1e62a3c4ec --- /dev/null +++ b/modules/ticket/back/models/gls-expedition.json @@ -0,0 +1,26 @@ +{ + "name": "GlsExpedition", + "base": "VnModel", + "options": { + "mysql": { + "table": "glsExpedition" + } + }, + "properties": { + "expeditionFk": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "barcode": { + "type": "string" + } + }, + "relations": { + "expedition": { + "type": "belongsTo", + "model": "Expedition", + "foreignKey": "expeditionFk" + } + } +}