change in electricals in quotation sending

master
Varun 1 year ago
parent 29b86221c4
commit 6f97ffe883

@ -1080,12 +1080,6 @@ exports.createquotationforSensor = async (req, reply) => {
const { customerId, masters, slaves, motor_switches, electricals } = req.body;
// Validate electricals field to ensure it's an array of objects
if (!Array.isArray(electricals) || electricals.some(e => typeof e !== 'object')) {
return reply.code(400).send({
success: false,
message: 'Invalid data format for electricals. It should be an array of objects with "name" and "type".'
});
}
// Create a new SensorQuotation document
const newQuotation = new SensorQuotation({

@ -260,16 +260,8 @@ const sensorquotationSchema = new mongoose.Schema({
quote_status: { type: String, default: null },
quoted_amount: { type: String, default: null },
comments: { type: String, default: null },
// Define electricals as an array of strings or objects
electricals: [
{
name: { type: String },
type: { type: String },
}
]
electricals: { type: String },
});

@ -789,18 +789,8 @@ fastify.post("/api/createquotationforSensor/:installationId", {
masters: { type: "string" },
slaves: { type: "string" },
motor_switches: { type: "string" },
electricals: {
type: "array",
description: "List of electrical items",
items: {
type: "object",
properties: {
name: { type: "string", description: "Name of the electrical item" },
type: { type: "string", description: "Type of the electrical item" },
},
required: ["name", "type"],
},
},
electricals: { type: "string" },
},
},

Loading…
Cancel
Save