latitude and longitude

master
Bhaskara Kishore 3 years ago
parent 21b384c6ac
commit 94af513b6e

@ -80,6 +80,8 @@ exports.loginSupplier = async (req) => {
office_adress: req.body.office_adress, office_adress: req.body.office_adress,
zip: req.body.zip, zip: req.body.zip,
}, },
latitude: req.body.latitude,
longitude: req.body.longitude
}; };
var supplier = new Supplier(s_data); var supplier = new Supplier(s_data);
@ -102,6 +104,8 @@ exports.loginSupplier = async (req) => {
supplier.supplierId = suppliertobeInserted.supplier_id; supplier.supplierId = suppliertobeInserted.supplier_id;
supplier.office_adress = suppliertobeInserted.office_adress; supplier.office_adress = suppliertobeInserted.office_adress;
supplier.alternativeContactNumber = suppliertobeInserted.alternativeContactNumber; supplier.alternativeContactNumber = suppliertobeInserted.alternativeContactNumber;
supplier.latitude = suppliertobeInserted.latitude;
supplier.longitude = suppliertobeInserted.longitude;
} }
@ -120,7 +124,7 @@ exports.loginSupplier = async (req) => {
role = ["supplier"]; role = ["supplier"];
supplier.profile.role = role; supplier.profile.role = role;
} }
insertedSupplier = await supplier.save(); insertedSupplier = await supplier.save();
console.log(insertedSupplier); console.log(insertedSupplier);
if (insertedSupplier) { if (insertedSupplier) {
@ -137,6 +141,8 @@ exports.loginSupplier = async (req) => {
}, },
], ],
profile: insertedSupplier.profile, profile: insertedSupplier.profile,
latitude: insertedSupplier.latitude,
longitude: insertedSupplier.longitude
}, },
status_code: 200, status_code: 200,
}; };

@ -192,6 +192,8 @@ exports.loginSupplier = async(request, reply) =>{
office_address: loginObject.supplier.profile.office_address, office_address: loginObject.supplier.profile.office_address,
phoneVerified: loginObject.supplier.phoneVerified, phoneVerified: loginObject.supplier.phoneVerified,
oneTimePasswordSetFlag: loginObject.supplier.oneTimePasswordSetFlag, oneTimePasswordSetFlag: loginObject.supplier.oneTimePasswordSetFlag,
latitude: loginObject.supplier.latitude,
longitude: loginObject.supplier.longitude,
type: loginObject.supplier.profile.role, type: loginObject.supplier.profile.role,
typeasobj: stringToJsonObject, typeasobj: stringToJsonObject,
}, },
@ -210,6 +212,8 @@ exports.loginSupplier = async(request, reply) =>{
office_address: loginObject.supplier.profile.office_address, office_address: loginObject.supplier.profile.office_address,
phoneVerified: loginObject.supplier.phoneVerified, phoneVerified: loginObject.supplier.phoneVerified,
oneTimePasswordSetFlag: loginObject.supplier.oneTimePasswordSetFlag, oneTimePasswordSetFlag: loginObject.supplier.oneTimePasswordSetFlag,
latitude: loginObject.supplier.latitude,
longitude: loginObject.supplier.longitude,
type: loginObject.supplier.profile.role, type: loginObject.supplier.profile.role,
typeasobj: stringToJsonObject, typeasobj: stringToJsonObject,
}, },

@ -48,17 +48,22 @@ const supplierSchema = new mongoose.Schema(
default: 'pending' default: 'pending'
}, },
currentGPS: { // currentGPS: {
// It's important to define type within type field, because // // It's important to define type within type field, because
// mongoose use "type" to identify field's object type. // // mongoose use "type" to identify field's object type.
gpsType: { type: String, default: "Point" },
// Default value is needed. Mongoose pass an empty array to
// array type by default, but it will fail MongoDB's pre-save
// validation.
coordinates: { type: [Number], default: [0, 0] },
},
// gpsType: { type: String, default: "Point" },
// // Default value is needed. Mongoose pass an empty array to
// // array type by default, but it will fail MongoDB's pre-save
// // validation.
// coordinates: { type: [Number], default: [0, 0] },
// },
// location: {
// type: { type: String },
// coordinates: [Number]
// },
longitude: { type : Number},
latitude: {type: Number},
isActive: Boolean, isActive: Boolean,
tenantId: ObjectId, tenantId: ObjectId,
createdAt: { createdAt: {

@ -93,6 +93,8 @@ module.exports = function (fastify, opts, next) {
state: { type: "string", default: null }, state: { type: "string", default: null },
zip: { type: "string", default: null }, zip: { type: "string", default: null },
country: { type: "string", default: null }, country: { type: "string", default: null },
latitude: { type: 'number' },
longitude: { type: 'number'}
}, },
}, },
security: [ security: [

Loading…
Cancel
Save