added google location

master^2
Varun 5 months ago
parent 5934820058
commit d42b4fef5a

@ -1622,6 +1622,7 @@ exports.createquotationforSensor = async (req, reply) => {
const { surveyId } = req.params; const { surveyId } = req.params;
const { customerId, masters, slaves, sensors, motor_switches, electricals,master_connections } = req.body; const { customerId, masters, slaves, sensors, motor_switches, electricals,master_connections } = req.body;
// Format electricals field // Format electricals field
const formattedElectricals = electricals.map((item) => ({ const formattedElectricals = electricals.map((item) => ({
type: item.type || "", type: item.type || "",
@ -1633,6 +1634,9 @@ exports.createquotationforSensor = async (req, reply) => {
master_name: item.master_name || "", master_name: item.master_name || "",
slaves: item.slaves || "", slaves: item.slaves || "",
location: item.location || "", location: item.location || "",
googleLocation: item.googleLocation || "",
latitude: item.latitude || "",
longitude: item.longitude || "",
tanks: Array.isArray(item.tanks) tanks: Array.isArray(item.tanks)
? item.tanks.map(tank => ({ ? item.tanks.map(tank => ({
tankName: tank.tankName || "", tankName: tank.tankName || "",

@ -525,6 +525,9 @@ const sensorquotationSchema = new mongoose.Schema({
master_name: { type: String, default: null }, master_name: { type: String, default: null },
slaves: { type: String, default: null }, slaves: { type: String, default: null },
location: { type: String, default: null }, location: { type: String, default: null },
googleLocation: { type: String, default: null },
longitude: { type : Number,default: 0.0},
latitude: {type: Number,default: 0.0},
tanks: [ tanks: [
{ {
tankName: { type: String, default: null }, tankName: { type: String, default: null },

@ -1428,6 +1428,9 @@ fastify.post("/api/createquotationforSensor/:surveyId", {
master_name: { type: "string", default: null }, master_name: { type: "string", default: null },
slaves: { type: "string", default: null }, slaves: { type: "string", default: null },
location: { type: "string", default: null }, location: { type: "string", default: null },
googleLocation: { type: "string", default: null },
latitude: { type: 'number', default: 0.0 },
longitude: { type: 'number', default: 0.0},
tanks: { tanks: {
type: "array", type: "array",
items: { items: {

Loading…
Cancel
Save