Bhaskar 7 months ago
commit 22983aea4e

@ -1600,7 +1600,8 @@ exports.editQuotationForSensor = async (req, reply) => {
exports.createEstimationPrice = async (req, reply) => {
try {
const { items } = req.body;
const { customerId,items } = req.body;
const user = await User.findOne({ customerId });
if (!Array.isArray(items) || items.length === 0) {
return reply.code(400).send({ message: "Items array is required and cannot be empty" });
@ -1642,7 +1643,8 @@ exports.createEstimationPrice = async (req, reply) => {
return reply.code(200).send({
items: itemDetails,
estimatedTotal: totalEstimation
estimatedTotal: totalEstimation,
userDetails: user || null // Include user details in the response
});
} catch (error) {

@ -1318,6 +1318,7 @@ fastify.post("/api/createEstimationPrice", {
body: {
type: "object",
properties: {
customerId: { type: "string", description: "Customer ID" },
items: {
type: "array",
description: "List of items",
@ -1325,6 +1326,7 @@ fastify.post("/api/createEstimationPrice", {
type: "object",
properties: {
name: { type: "string", description: "Item name" },
type: { type: "string", description: "Item type" },
quantity: { type: "string", description: "Quantity of the item" }
},

Loading…
Cancel
Save