|
|
|
@ -25,15 +25,18 @@ exports.installSignUp = async (request, reply) => {
|
|
|
|
|
longitude,
|
|
|
|
|
latitude,
|
|
|
|
|
fcmId,
|
|
|
|
|
alternativeNumber,
|
|
|
|
|
firstName,
|
|
|
|
|
lastName,
|
|
|
|
|
createdBy,
|
|
|
|
|
updatedBy,
|
|
|
|
|
} = request.body;
|
|
|
|
|
|
|
|
|
|
// Check if the email address is valid
|
|
|
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
|
|
if (emails.some((emailObj) => !emailRegex.test(emailObj.email))) {
|
|
|
|
|
return reply.status(400).send({ message: 'Invalid email address' });
|
|
|
|
|
}
|
|
|
|
|
// const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
|
|
// if (emails.some((emailObj) => !emailRegex.test(emailObj.email))) {
|
|
|
|
|
// return reply.status(400).send({ message: 'Invalid email address' });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Check if a user with the same phone number already exists
|
|
|
|
|
const existingInstall = await Install.findOne({ phone });
|
|
|
|
@ -58,8 +61,12 @@ exports.installSignUp = async (request, reply) => {
|
|
|
|
|
longitude,
|
|
|
|
|
latitude,
|
|
|
|
|
fcmId,
|
|
|
|
|
alternativeNumber,
|
|
|
|
|
firstName,
|
|
|
|
|
lastName,
|
|
|
|
|
createdBy,
|
|
|
|
|
updatedBy,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Save the new install to the database
|
|
|
|
|