firstname, lastname & alternative fields are added

master
Naidu 1 year ago
parent 03953a5aed
commit 15dc03f08e

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

@ -351,6 +351,9 @@ fastify.post("/api/installotplogin", {
team: loginObject.user.team, team: loginObject.user.team,
city:loginObject.user.city, city:loginObject.user.city,
manager:loginObject.user.manager, manager:loginObject.user.manager,
firstName:loginObject.user.firstName,
lastName:loginObject.user.lastName,
alternativeNumber:loginObject.user.alternativeNumber,
// typeasobj: JSON.parse(loginObject.user.profile.role), // typeasobj: JSON.parse(loginObject.user.profile.role),
}, },
}; };

@ -18,6 +18,8 @@ const installationschema = new mongoose.Schema({
profile: { profile: {
alternativeNumber: { type: String, default: null }, alternativeNumber: { type: String, default: null },
firstName: { type: String, default: null },
lastName: { type: String, default: null },
address1: { type: String, default: null }, address1: { type: String, default: null },
address2: { type: String, default: null }, address2: { type: String, default: null },
city: { type: String, default: null }, city: { type: String, default: null },

@ -38,6 +38,9 @@ module.exports = function (fastify, opts, next) {
latitude: { type: 'number', default: 0.0 }, latitude: { type: 'number', default: 0.0 },
longitude: { type: 'number', default: 0.0 }, longitude: { type: 'number', default: 0.0 },
fcmId: { type: 'string', default: null }, fcmId: { type: 'string', default: null },
alternativeNumber : { type: 'string', default: null },
firstName :{ type: 'string', default: null },
lastName : { type: 'string', default: null },
}, },
}, },
security: [ security: [

Loading…
Cancel
Save