diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index bcb33432..9e440f0f 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -2021,7 +2021,7 @@ exports.getOrdersByCustomer = async (req, reply) => { exports.acceptQuotation = async (req, reply) => { try { const { quotationId } = req.params; - let { action } = req.body; + let { action, storeId } = req.body; action = action.toLowerCase(); // Convert action to lowercase @@ -2041,9 +2041,10 @@ exports.acceptQuotation = async (req, reply) => { message: "Quotation rejected successfully", }); } else if (action === "accept") { - // Convert quotation to an order object + // Convert quotation to an order object and include storeId const newOrder = new Order({ - ...quotation.toObject(), // Copy all fields + ...quotation.toObject(), // Copy all fields from quotation + storeId: storeId, // Ensure storeId is included status: "pending", // Set status to "pending" }); diff --git a/src/routes/storeRoute.js b/src/routes/storeRoute.js index 93395ccb..f034f0f6 100644 --- a/src/routes/storeRoute.js +++ b/src/routes/storeRoute.js @@ -1314,6 +1314,7 @@ fastify.post("/api/createquotationforSensor/:surveyId", { type: "object", properties: { customerId: { type: "string" }, + masters: { type: "string" }, slaves: { type: "string" }, sensors: { type: "string" }, @@ -1671,6 +1672,7 @@ fastify.post("/api/acceptquotation/:quotationId", { type: "object", properties: { action: { type: "string" }, + storeId: { type: "string" }, }, required: ["action"], },