changes in accept quotatioin

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

@ -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"
});

@ -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"],
},

Loading…
Cancel
Save