From 9b0a1ef7d346b05a76266f72cae6e5b1d0764208 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 5 Feb 2026 10:46:28 +0530 Subject: [PATCH] Submission data attached in create submission api : GWM --- app/controllers/submission.controller.js | 43 +++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/app/controllers/submission.controller.js b/app/controllers/submission.controller.js index 3b39d68..a23207f 100644 --- a/app/controllers/submission.controller.js +++ b/app/controllers/submission.controller.js @@ -252,10 +252,51 @@ exports.createSubmission = async (req, res) => { ...adminEmailPromises, ]); + + + + + //send inserted data to FE + let submission_data = await Submission.findOne( { + where: { id : submission.id }, + include: [ + { + model: Establishment, + as: "establishment" , + }, + { + model: SubmissionProduct, + as: "products", + include: [ + { + model: Product, + as: "product", + attributes: ["id", "product_name", "hs_code", "hs_description"], + }, + { + model: UnitMaster, + as: "unit", + attributes: ["uom"], + }, + { + model: VariationReasonMaster, + as: "variation_reason", + attributes: ["reason"], + }, + { + model: ZeroTargetReasonMaster, + as: "zero_target_reason", + attributes: ["reason"], + }, + ], + }, + ], + }); + - res.status(201).json({ status: "success", message: "Submission created sucessfully.", submission_id : submission.id}); + res.status(201).json({ status: "success", message: "Submission created sucessfully.", submission_data : submission_data}); } catch (err) { logger.error(err.message);