changes in accept quotatioin

master^2
Varun 10 months ago
parent 8f76754911
commit 7932e3027b

@ -2021,7 +2021,7 @@ exports.getOrdersByCustomer = async (req, reply) => {
exports.acceptQuotation = async (req, reply) => { exports.acceptQuotation = async (req, reply) => {
try { try {
const { quotationId } = req.params; const { quotationId } = req.params;
let { action } = req.body; let { action, storeId } = req.body;
action = action.toLowerCase(); // Convert action to lowercase action = action.toLowerCase(); // Convert action to lowercase
@ -2041,9 +2041,10 @@ exports.acceptQuotation = async (req, reply) => {
message: "Quotation rejected successfully", message: "Quotation rejected successfully",
}); });
} else if (action === "accept") { } else if (action === "accept") {
// Convert quotation to an order object // Convert quotation to an order object and include storeId
const newOrder = new Order({ 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" status: "pending", // Set status to "pending"
}); });

@ -1314,6 +1314,7 @@ fastify.post("/api/createquotationforSensor/:surveyId", {
type: "object", type: "object",
properties: { properties: {
customerId: { type: "string" }, customerId: { type: "string" },
masters: { type: "string" }, masters: { type: "string" },
slaves: { type: "string" }, slaves: { type: "string" },
sensors: { type: "string" }, sensors: { type: "string" },
@ -1671,6 +1672,7 @@ fastify.post("/api/acceptquotation/:quotationId", {
type: "object", type: "object",
properties: { properties: {
action: { type: "string" }, action: { type: "string" },
storeId: { type: "string" },
}, },
required: ["action"], required: ["action"],
}, },

Loading…
Cancel
Save