From 69b90eabd3741c53c7012e92a3d5a09cfabbc17d Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 22 Jun 2026 12:48:13 +0530 Subject: [PATCH] GWM : calculation api validation --- app/controllers/calculation.controller.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/controllers/calculation.controller.js b/app/controllers/calculation.controller.js index b91e62c..0110deb 100644 --- a/app/controllers/calculation.controller.js +++ b/app/controllers/calculation.controller.js @@ -128,6 +128,20 @@ exports.calculate_month = async (req, res) => { }); } + // check if the year and quarter window created or not and start the calculation + const window = await QuarterlyWindowsConfiguration.findOne({ + where: { + year: year, + quarter: quarter + } + }); + if (!window) { + return res.status(400).json({ + success: false, + message: 'Year and quarter window not created' + }); + } + const service = new IPICalculationService(dbConfig); const result = await service.runCompleteCalculation(year, quarter); await service.close();