From 66119997b49a4e3c5926521b2c6b4236818ee06e Mon Sep 17 00:00:00 2001 From: Varun Date: Fri, 27 Dec 2024 10:48:18 +0530 Subject: [PATCH] changed electricals in quotation --- src/controllers/storeController.js | 6 ++---- src/models/store.js | 6 +++--- src/routes/storeRoute.js | 19 ++++++++----------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index 173fedf5..d36cbf0a 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -1285,7 +1285,7 @@ exports.createquotationforSensor = async (req, reply) => { const i_id = await generatequatationId(); const quatationId = `AWQU${i_id}`; const { installationId } = req.params; - const { customerId, masters, slaves, motor_switches, electricals,master_type,sensor_type,switch_type } = req.body; + const { customerId, masters, slaves, motor_switches, electricals } = req.body; // Create a new SensorQuotation document @@ -1297,9 +1297,7 @@ exports.createquotationforSensor = async (req, reply) => { slaves, motor_switches, electricals, - switch_type, - master_type, - sensor_type + }); const savedQuotation = await newQuotation.save(); diff --git a/src/models/store.js b/src/models/store.js index 6af37463..72cdaf73 100644 --- a/src/models/store.js +++ b/src/models/store.js @@ -290,13 +290,13 @@ const sensorquotationSchema = new mongoose.Schema({ quote_status: { type: String, default: null }, quoted_amount: { type: String, default: null }, comments: { type: String, default: null }, - master_type: { type: String, default: null }, + electricals: [{ type: String }], master_type_quantity_price: { type: String, default: null }, master_type_total_price: { type: String, default: null }, - sensor_type: { type: String , default: null}, + sensor_type_quantity_price: { type: String , default: null}, sensor_type_total_price: { type: String , default: null}, - switch_type: { type: String, default: null }, + switch_type_quantity_price: { type: String, default: null }, switch_type_total_price: { type: String, default: null }, qutation_total_price: { type: String, default: null }, diff --git a/src/routes/storeRoute.js b/src/routes/storeRoute.js index 23f75916..f1bc02fc 100644 --- a/src/routes/storeRoute.js +++ b/src/routes/storeRoute.js @@ -1149,27 +1149,24 @@ fastify.post("/api/createquotationforSensor/:installationId", { }, }, }, - body: { type: "object", - properties: { - customerId: { type: "string" }, masters: { type: "string" }, slaves: { type: "string" }, - motor_switches: { type: "string" }, - electricals: { type: "string" }, - master_type: { type: "string" }, - sensor_type: { type: "string" }, - switch_type: { type: "string" }, - - + motor_switches: { type: "string" }, + electricals: { + type: "array", + items: { type: "string" }, + description: "List of electrical items", + }, }, }, }, handler: storeController.createquotationforSensor, -}) +}); +