From 995a99c66131127021c96f3a3fe5ca1c96423e0a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 12 Feb 2024 08:53:55 +0100 Subject: [PATCH] refs #5858 feat: removeZoneIncludedCheck --- .../methods/zone/specs/deleteZone.spec.js | 15 ------- modules/zone/back/model-config.json | 7 +-- .../zone/back/models/zone-included-check.json | 44 ------------------- 3 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 modules/zone/back/models/zone-included-check.json diff --git a/modules/zone/back/methods/zone/specs/deleteZone.spec.js b/modules/zone/back/methods/zone/specs/deleteZone.spec.js index b5cdbba52..e105bb296 100644 --- a/modules/zone/back/methods/zone/specs/deleteZone.spec.js +++ b/modules/zone/back/methods/zone/specs/deleteZone.spec.js @@ -47,14 +47,10 @@ describe('zone deletezone()', () => { it('should NOT delete a zone if is included check', async() => { const tx = await models.Zone.beginTransaction({}); - let isIncluded = false; try { const options = {transaction: tx}; - const zoneIncludedCheck = await models.ZoneIncludedCheck.find({where: {zoneFk: zoneId}}); - isIncluded = zoneIncludedCheck.length > 0; await models.Zone.deleteZone(ctx, zoneId, options); } catch (e) { - expect(isIncluded).toBeTrue(); expect(e).not.toBeNull(); await tx.rollback(); } @@ -71,17 +67,6 @@ describe('zone deletezone()', () => { const zoneIncludedDeleted = await models.ZoneIncluded.find({where: {zoneFk: zoneId}}, options); expect(zoneIncludedDeleted.length).toEqual(0); - const zoneIncludedCheck = await models.ZoneIncludedCheck.find({where: {zoneFk: zoneId}}, options); - - expect(zoneIncludedCheck.length).toEqual(2); - // Insert - await models.ZoneIncludedCheck.destroyById(zoneIncludedCheck[0].id, options); - // Delete - await models.ZoneIncludedCheck.destroyById(zoneIncludedCheck[1].id, options); - - const zoneIncludedCheckDeleted = await models.ZoneIncludedCheck.find({where: {zoneFk: zoneId}}, options); - - expect(zoneIncludedCheckDeleted.length).toEqual(0); await models.Zone.deleteZone(ctx, zoneId, options); diff --git a/modules/zone/back/model-config.json b/modules/zone/back/model-config.json index 72c755978..3bbbe0d1b 100644 --- a/modules/zone/back/model-config.json +++ b/modules/zone/back/model-config.json @@ -3,10 +3,10 @@ "dataSource": "vn" }, "AgencyMode": { - "dataSource": "vn" + "dataSource": "vn" }, "DeliveryMethod": { - "dataSource": "vn" + "dataSource": "vn" }, "Zone": { "dataSource": "vn" @@ -32,9 +32,6 @@ "ZoneIncluded": { "dataSource": "vn" }, - "ZoneIncludedCheck": { - "dataSource": "vn" - }, "ZoneWarehouse": { "dataSource": "vn" }, diff --git a/modules/zone/back/models/zone-included-check.json b/modules/zone/back/models/zone-included-check.json deleted file mode 100644 index 8affee92c..000000000 --- a/modules/zone/back/models/zone-included-check.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "ZoneIncludedCheck", - "base": "Loggable", - "options": { - "mysql": { - "table": "zoneIncludedCheck" - } - }, - "properties": { - "id": { - "id": true, - "type": "number" - }, - "zoneFk": { - "type": "int" - }, - "geoFk": { - "type": "int" - }, - "userFk": { - "type": "int" - }, - "action": { - "type": "string" - } - }, - "relations": { - "zone": { - "type": "belongsTo", - "model": "Zone", - "foreignKey": "zoneFk" - }, - "geo": { - "type": "belongsTo", - "model": "ZoneGeo", - "foreignKey": "geoFk" - }, - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "userFk" - } - } -}