From 84997eacd5b42f923a4395dcc5bba9bce47c16ab Mon Sep 17 00:00:00 2001 From: jcasado Date: Mon, 8 Apr 2024 14:38:54 +0200 Subject: [PATCH 1/3] refs: 6697 remove claim quantity --- modules/claim/back/methods/claim/createFromSales.js | 2 +- modules/claim/back/models/claim-beginning.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/methods/claim/createFromSales.js b/modules/claim/back/methods/claim/createFromSales.js index 30093e43d..e5022d57e 100644 --- a/modules/claim/back/methods/claim/createFromSales.js +++ b/modules/claim/back/methods/claim/createFromSales.js @@ -83,7 +83,7 @@ module.exports = Self => { const newClaimBeginning = models.ClaimBeginning.create({ saleFk: sale.id, claimFk: newClaim.id, - quantity: sale.quantity + }, myOptions); promises.push(newClaimBeginning); diff --git a/modules/claim/back/models/claim-beginning.json b/modules/claim/back/models/claim-beginning.json index d224586da..ba6e83808 100644 --- a/modules/claim/back/models/claim-beginning.json +++ b/modules/claim/back/models/claim-beginning.json @@ -16,8 +16,7 @@ "description": "Identifier" }, "quantity": { - "type": "number", - "required": true + "type": "number" } }, "relations": { From d1659ce04c87ffb7bb531c07de854fd19cd7cf84 Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 24 Apr 2024 11:19:15 +0200 Subject: [PATCH 2/3] refs #6697 fix claimQuantity --- modules/claim/back/methods/claim/createFromSales.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/claim/back/methods/claim/createFromSales.js b/modules/claim/back/methods/claim/createFromSales.js index e5022d57e..1af479dbb 100644 --- a/modules/claim/back/methods/claim/createFromSales.js +++ b/modules/claim/back/methods/claim/createFromSales.js @@ -83,7 +83,6 @@ module.exports = Self => { const newClaimBeginning = models.ClaimBeginning.create({ saleFk: sale.id, claimFk: newClaim.id, - }, myOptions); promises.push(newClaimBeginning); From aeee012c2b353608afc45e495a0d0ed5bcbb6ee1 Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 24 Apr 2024 11:43:10 +0200 Subject: [PATCH 3/3] refs #6697 fix sql test --- db/versions/11014-orangePalmetto/00-firstScript.sql | 2 ++ .../claim/back/methods/claim/specs/createFromSales.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 db/versions/11014-orangePalmetto/00-firstScript.sql diff --git a/db/versions/11014-orangePalmetto/00-firstScript.sql b/db/versions/11014-orangePalmetto/00-firstScript.sql new file mode 100644 index 000000000..fe85c7ec6 --- /dev/null +++ b/db/versions/11014-orangePalmetto/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE vn.claimBeginning MODIFY COLUMN quantity double DEFAULT 0 NULL; diff --git a/modules/claim/back/methods/claim/specs/createFromSales.spec.js b/modules/claim/back/methods/claim/specs/createFromSales.spec.js index fe009c1c3..25414d1db 100644 --- a/modules/claim/back/methods/claim/specs/createFromSales.spec.js +++ b/modules/claim/back/methods/claim/specs/createFromSales.spec.js @@ -37,7 +37,7 @@ describe('Claim createFromSales()', () => { let claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options); expect(claimBeginning.saleFk).toEqual(newSale[0].id); - expect(claimBeginning.quantity).toEqual(newSale[0].quantity); + expect(claimBeginning.quantity).toEqual(0); await tx.rollback(); } catch (e) { @@ -67,7 +67,7 @@ describe('Claim createFromSales()', () => { const claimBeginning = await models.ClaimBeginning.findOne({where: {claimFk: claim.id}}, options); expect(claimBeginning.saleFk).toEqual(newSale[0].id); - expect(claimBeginning.quantity).toEqual(newSale[0].quantity); + expect(claimBeginning.quantity).toEqual(0); await tx.rollback(); } catch (e) {