diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index c083671d..dcf9b5d3 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -1300,6 +1300,7 @@ exports.createquotationforSensor = async (req, reply) => { quatationId, customerId: customerId, installationId: installationId, + quote_status:"sentfrominstaller", masters, slaves, sensors, @@ -1498,4 +1499,30 @@ exports.addToCartService = async (req, reply) => { console.error(error); reply.code(500).send({ message: 'Error adding item to cart', error }); } +}; + + + + +exports.getquotationofinstalleranduser = async (req, reply) => { + try { + const installationId = req.params.installationId; + const customerId = req.body.customerId; + + // Find the specific tank + const result = await SensorQuotation.find({ + installationId: installationId, + customerId: customerId, + + }); + + if (!result) { + return reply.send({ status_code: 404, error: "not found" }); + } + + + reply.send({ status_code: 200, data: result }); + } catch (err) { + throw boom.boomify(err); + } }; \ No newline at end of file diff --git a/src/routes/storeRoute.js b/src/routes/storeRoute.js index 769ec956..f401687d 100644 --- a/src/routes/storeRoute.js +++ b/src/routes/storeRoute.js @@ -1178,6 +1178,40 @@ fastify.post("/api/createquotationforSensor/:installationId", { }); +fastify.post("/api/getquotationofinstalleranduser/:installationId", { + schema: { + tags: ["Install"], + description: "This is to Get Quotations for installer and particular user", + summary: "This is to Get Quotations for installer and particular user", + params: { + required: ["installationId"], + type: "object", + properties: { + installationId: { + type: "string", + description: "installationId", + }, + }, + }, + body: { + type: "object", + + properties: { + customerId: { type: "string" }, + + }, + }, + security: [ + { + basicAuth: [], + }, + ], + }, + // preHandler: fastify.auth([fastify.authenticate]), + handler: storeController.getquotationofinstalleranduser, +}); + + fastify.get("/api/getallquotationdata", {