diff --git a/app/routes/routes.js b/app/routes/routes.js index ef89a19..a30d5c8 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -17,6 +17,7 @@ const ConfigController = require("../controllers/config.controller"); const dashboardController = require("../controllers/dashboard.controller"); const notificationTemplateController = require("../controllers/notificationTemplate.controller"); const quarterlyWindowsController = require("../controllers/quarterlyWindowsConfiguration.controller"); +const calculationController = require("../controllers/calculation.controller"); const ManufacturingIpiController = require("../controllers/manufacturingIPI.controller") const fs = require("fs"); const path = require("path"); @@ -25,6 +26,114 @@ const { UPLOAD_DIR } = require("../config/upload.config"); const upload = multer({ dest: UPLOAD_DIR }); + + +/** + * @swagger + * /api/calculate_base_year: + * post: + * summary: Base year calculation 2022 + * tags: [IIP Calculation] + * security: + * - appSignature: [] + * - CSRF: [] + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * required: + * - baseYear + * - forceRecalculate + * properties: + * baseYear: + * type: integer + * example: 2022 + * forceRecalculate: + * type: string + * example: false + * responses: + * 200: + * description: Base year production calculated successfully + */ + +router.post("/calculate_base_year",[] , calculationController.calculate_base_year); + +/** + * @swagger + * /api/survey_auto_submit: + * post: + * summary: Auto survey submission for Quarter + * tags: [IIP Calculation] + * security: + * - appSignature: [] + * - CSRF: [] + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * required: + * - year + * - quarter + * properties: + * year: + * type: integer + * example: 2025 + * quarter: + * type: string + * enum: [Q1, Q2, Q3, Q4] + * example: Q2 + * responses: + * 200: + * description: Auto survey completed successfully + */ +router.post("/survey_auto_submit",[] , calculationController.survey_auto_submit); + +/** + * @swagger + * /api/calculate_quarter: + * post: + * summary: Calculate IPI for a selected year and quarter (Quarter → Month mapping) + * tags: [IIP Calculation] + * security: + * - appSignature: [] + * - CSRF: [] + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * required: + * - year + * - quarter + * properties: + * year: + * type: integer + * example: 2025 + * quarter: + * type: string + * enum: [Q1, Q2, Q3, Q4] + * example: Q2 + * description: | + * Quarter to month mapping: + * - Q1 → Jan to Mar (1 - 3) + * - Q2 → Apr to Jun (4 - 6) + * - Q3 → Jul to Sep (7 - 9) + * - Q4 → Oct to Dec (10 - 12) + * responses: + * 200: + * description: Quarterly IPI calculation completed successfully + */ + +router.post("/calculate_quarter",[] , calculationController.calculate_quarter); + + +router.get("/calculate_month",[] , calculationController.calculate_month); + /**