From 940b4310590259f33a1475a68677e4cb26275ba3 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Wed, 5 Oct 2022 14:04:30 +0200 Subject: [PATCH 1/3] feat(model) Created the model for packagingMistake --- modules/ticket/back/model-config.json | 3 +++ .../ticket/back/models/packagingMistake.json | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 modules/ticket/back/models/packagingMistake.json diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 8a6ac0c00..859ecdef8 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -20,6 +20,9 @@ "Packaging": { "dataSource": "vn" }, + "PackagingMistake": { + "dataSource": "vn" + }, "PrintServerQueue": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/packagingMistake.json b/modules/ticket/back/models/packagingMistake.json new file mode 100644 index 000000000..7bfc0eca2 --- /dev/null +++ b/modules/ticket/back/models/packagingMistake.json @@ -0,0 +1,25 @@ +{ + "name": "PackagingMistake", + "base": "VnModel", + "options": { + "mysql": { + "table": "packagingMistake" + } + }, + "properties": { + "expeditionFk": { + "id": true, + "type": "number" + }, + "workerFk": { + "type": "number" + }, + "typeFk": { + "type": "number" + }, + "created": { + "type": "date" + } + } + } + \ No newline at end of file From d540e278eb659c537d73a3aad5171ee04dcae1d4 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 10 Jan 2023 13:52:30 +0100 Subject: [PATCH 2/3] refs #4605 @30min --- modules/ticket/back/model-config.json | 2 +- .../models/{packagingMistake.json => expeditionMistake.json} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename modules/ticket/back/models/{packagingMistake.json => expeditionMistake.json} (82%) diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 859ecdef8..4187973d0 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -20,7 +20,7 @@ "Packaging": { "dataSource": "vn" }, - "PackagingMistake": { + "ExpeditionMistake": { "dataSource": "vn" }, "PrintServerQueue": { diff --git a/modules/ticket/back/models/packagingMistake.json b/modules/ticket/back/models/expeditionMistake.json similarity index 82% rename from modules/ticket/back/models/packagingMistake.json rename to modules/ticket/back/models/expeditionMistake.json index 7bfc0eca2..e01f2f4be 100644 --- a/modules/ticket/back/models/packagingMistake.json +++ b/modules/ticket/back/models/expeditionMistake.json @@ -1,9 +1,9 @@ { - "name": "PackagingMistake", + "name": "ExpeditionMistake", "base": "VnModel", "options": { "mysql": { - "table": "packagingMistake" + "table": "expeditionMistake" } }, "properties": { From a8e4c9e1debc1917133da3336248efe4c1bb3c26 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Fri, 13 Jan 2023 15:42:00 +0100 Subject: [PATCH 3/3] cambiar fks por relaciones --- .../ticket/back/models/expeditionMistake.json | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/modules/ticket/back/models/expeditionMistake.json b/modules/ticket/back/models/expeditionMistake.json index e01f2f4be..43033194a 100644 --- a/modules/ticket/back/models/expeditionMistake.json +++ b/modules/ticket/back/models/expeditionMistake.json @@ -7,19 +7,27 @@ } }, "properties": { - "expeditionFk": { - "id": true, - "type": "number" - }, - "workerFk": { - "type": "number" - }, - "typeFk": { - "type": "number" - }, "created": { "type": "date" } + }, + "relations": { + "expedition": { + "type": "belongsTo", + "model": "Expedition", + "foreignKey": "expeditionFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "type": { + "type": "belongsTo", + "model": "MistakeType", + "foreignKey": "typeFk" + } } + } \ No newline at end of file