changes in survey

master^2
Varun 5 months ago
parent ddeb6540a3
commit acc1c65eb9

@ -1638,7 +1638,18 @@ exports.createquotationforSensor = async (req, reply) => {
tankName: tank.tankName || "",
tankLocation: tank.tankLocation || ""
}))
: []
: [],
motor_switches: Array.isArray(item.motor_switches)
? item.motor_switches.map(motor_switch => ({
from_tank: motor_switch.from_tank || "",
from_location: motor_switch.from_location || "",
to_tank: motor_switch.to_tank || "",
to_location: motor_switch.to_location || "",
}))
: [],
}));
// Fetch pricing data from Iotprice database
@ -1705,6 +1716,8 @@ exports.createquotationforSensor = async (req, reply) => {
exports.editQuotationForSensor = async (req, reply) => {
try {
const { quatationId } = req.params; // Get the ID of the quotation to edit

@ -528,6 +528,15 @@ const sensorquotationSchema = new mongoose.Schema({
},
],
motor_switches: [
{
from_tank: { type: String, default: null },
from_location: { type: String, default: null },
to_tank: { type: String, default: null },
to_location: { type: String, default: null },
},
],
},
],

@ -1439,6 +1439,19 @@ fastify.post("/api/createquotationforSensor/:surveyId", {
},
default: [],
},
motor_switches: {
type: "array",
items: {
type: "object",
properties: {
from_tank: { type: "string", default: null },
from_location: { type: "string", default: null },
to_tank: { type: "string", default: null },
to_location: { type: "string", default: null }
},
},
default: [],
},
},
},
},
@ -1462,6 +1475,7 @@ fastify.post("/api/createquotationforSensor/:surveyId", {
handler: storeController.createquotationforSensor,
});
fastify.post("/api/createEstimationPrice", {
schema: {
description: "Calculate estimated cost for a list of items",

Loading…
Cancel
Save