|
|
@ -238,6 +238,33 @@ exports.loginSupplier = async(request, reply) =>{
|
|
|
|
|
|
|
|
|
|
|
|
//Login Delivery Handler
|
|
|
|
//Login Delivery Handler
|
|
|
|
exports.loginDeliveryBoy = async(request, reply) =>{
|
|
|
|
exports.loginDeliveryBoy = async(request, reply) =>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
phone = request.body.phone;
|
|
|
|
|
|
|
|
phoneVerificationCode = request.body.phoneVerificationCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if user exists in the system. If user exists , display message that
|
|
|
|
|
|
|
|
// username is not available
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
|
|
|
|
"this is the phone and verification code",
|
|
|
|
|
|
|
|
phone,
|
|
|
|
|
|
|
|
phoneVerificationCode
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
deliveryBoyExists = await DeliveryBoy.findOne({
|
|
|
|
|
|
|
|
phone: phone,
|
|
|
|
|
|
|
|
phoneVerified: false,
|
|
|
|
|
|
|
|
phoneVerificationCode: phoneVerificationCode,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log(deliveryBoyExists);
|
|
|
|
|
|
|
|
if (deliveryBoyExists) {
|
|
|
|
|
|
|
|
// update the phoneVerified flag to true.
|
|
|
|
|
|
|
|
const filter = {
|
|
|
|
|
|
|
|
phone: phone,
|
|
|
|
|
|
|
|
phoneVerificationCode: phoneVerificationCode,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const update = { phoneVerified: true };
|
|
|
|
|
|
|
|
const doc = await DeliveryBoy.findOneAndUpdate(filter, update);
|
|
|
|
|
|
|
|
updatedDeliveryBoy = await DeliveryBoy.findOne({ phone: phone });
|
|
|
|
|
|
|
|
}
|
|
|
|
loginObject = await supplierController.loginDeliveryBoy(request);
|
|
|
|
loginObject = await supplierController.loginDeliveryBoy(request);
|
|
|
|
console.log("loginObject...",loginObject)
|
|
|
|
console.log("loginObject...",loginObject)
|
|
|
|
if (loginObject.same) {
|
|
|
|
if (loginObject.same) {
|
|
|
@ -308,7 +335,10 @@ exports.loginDeliveryBoy = async(request, reply) =>{
|
|
|
|
address: loginObject.delivery.address,
|
|
|
|
address: loginObject.delivery.address,
|
|
|
|
phoneVerified: loginObject.delivery.phoneVerified,
|
|
|
|
phoneVerified: loginObject.delivery.phoneVerified,
|
|
|
|
oneTimePasswordSetFlag: loginObject.delivery.oneTimePasswordSetFlag,
|
|
|
|
oneTimePasswordSetFlag: loginObject.delivery.oneTimePasswordSetFlag,
|
|
|
|
|
|
|
|
supplierId: loginObject.delivery.supplierId,
|
|
|
|
|
|
|
|
suppliername: loginObject.delivery.suppliername,
|
|
|
|
|
|
|
|
longitude:loginObject.delivery. longitude,
|
|
|
|
|
|
|
|
latitude:loginObject.delivery.latitude,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}if (profilePicture) {
|
|
|
|
}if (profilePicture) {
|
|
|
@ -324,6 +354,10 @@ exports.loginDeliveryBoy = async(request, reply) =>{
|
|
|
|
address: loginObject.delivery.address,
|
|
|
|
address: loginObject.delivery.address,
|
|
|
|
phoneVerified: loginObject.delivery.phoneVerified,
|
|
|
|
phoneVerified: loginObject.delivery.phoneVerified,
|
|
|
|
oneTimePasswordSetFlag: loginObject.delivery.oneTimePasswordSetFlag,
|
|
|
|
oneTimePasswordSetFlag: loginObject.delivery.oneTimePasswordSetFlag,
|
|
|
|
|
|
|
|
supplierId: loginObject.delivery.supplierId,
|
|
|
|
|
|
|
|
suppliername: loginObject.delivery.suppliername,
|
|
|
|
|
|
|
|
longitude:loginObject.delivery. longitude,
|
|
|
|
|
|
|
|
latitude:loginObject.delivery.latitude,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -677,16 +711,6 @@ exports.logoutsupplier = async (request, reply) => {
|
|
|
|
req.body.regError = error;
|
|
|
|
req.body.regError = error;
|
|
|
|
reply.send(error);
|
|
|
|
reply.send(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
error = {
|
|
|
|
|
|
|
|
armintatankdata: {
|
|
|
|
|
|
|
|
error: true,
|
|
|
|
|
|
|
|
code: 10005,
|
|
|
|
|
|
|
|
message: "10005 - Verification code entered cannot be validated.",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
req.body.regError = error;
|
|
|
|
|
|
|
|
reply.send(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
throw boom.boomify(err);
|
|
|
|
throw boom.boomify(err);
|
|
|
|