diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index 2419d3a5e..2f11ddefc 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 bee01a875..1e9977205 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 000000000..1e62a3c4e --- /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" + } + } +}