changes in quotation

master
Varun 1 year ago
parent 6f97ffe883
commit ffc463a2b8

@ -1077,7 +1077,7 @@ exports.createquotationforSensor = async (req, reply) => {
try { try {
// Extract parameters and body data from the request // Extract parameters and body data from the request
const { installationId } = req.params; const { installationId } = req.params;
const { customerId, masters, slaves, motor_switches, electricals } = req.body; const { customerId, masters, slaves, motor_switches, electricals,master_type,sensor_type,switch_type } = req.body;
// Validate electricals field to ensure it's an array of objects // Validate electricals field to ensure it's an array of objects
@ -1088,7 +1088,10 @@ exports.createquotationforSensor = async (req, reply) => {
masters, masters,
slaves, slaves,
motor_switches, motor_switches,
electricals, // This will store the array of electrical items (objects) electricals,
switch_type,
master_type,
sensor_type// This will store the array of electrical items (objects)
}); });
// Save the document to the database // Save the document to the database

@ -260,8 +260,10 @@ const sensorquotationSchema = new mongoose.Schema({
quote_status: { type: String, default: null }, quote_status: { type: String, default: null },
quoted_amount: { type: String, default: null }, quoted_amount: { type: String, default: null },
comments: { type: String, default: null }, comments: { type: String, default: null },
electricals: { type: String }, master_type: { type: String, default: null },
sensor_type: { type: String , default: null},
switch_type: { type: String, default: null },
}); });

@ -790,6 +790,9 @@ fastify.post("/api/createquotationforSensor/:installationId", {
slaves: { type: "string" }, slaves: { type: "string" },
motor_switches: { type: "string" }, motor_switches: { type: "string" },
electricals: { type: "string" }, electricals: { type: "string" },
master_type: { type: "string" },
sensor_type: { type: "string" },
switch_type: { type: "string" },
}, },

Loading…
Cancel
Save