#5858 - zoneCollisions #1853

Merged
jsegarra merged 78 commits from 5858-zone_Collisions into dev 2024-03-15 12:36:38 +00:00
3 changed files with 2 additions and 64 deletions
Showing only changes of commit 995a99c661 - Show all commits

View File

@ -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);

View File

@ -32,9 +32,6 @@
"ZoneIncluded": {
"dataSource": "vn"
},
"ZoneIncludedCheck": {
"dataSource": "vn"
},
"ZoneWarehouse": {
"dataSource": "vn"
},

View File

@ -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"
}
}
}