|
|
@ -1177,8 +1177,38 @@ fastify.post("/api/installLogin", {
|
|
|
|
await survey.save();
|
|
|
|
await survey.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const token = fastify.jwt.sign(
|
|
|
|
|
|
|
|
{ phone: user.phone, surveyId: user.surveyId },
|
|
|
|
|
|
|
|
"Scret",
|
|
|
|
|
|
|
|
{ expiresIn: "1h" }
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return reply.send(survey);
|
|
|
|
return reply.send({
|
|
|
|
|
|
|
|
simplydata: {
|
|
|
|
|
|
|
|
error: false,
|
|
|
|
|
|
|
|
message: "Login successful",
|
|
|
|
|
|
|
|
access_token: token,
|
|
|
|
|
|
|
|
phone: user.phone,
|
|
|
|
|
|
|
|
surveyId: user.surveyId,
|
|
|
|
|
|
|
|
firstName: user.firstName,
|
|
|
|
|
|
|
|
lastName: user.lastName,
|
|
|
|
|
|
|
|
email: user.email,
|
|
|
|
|
|
|
|
alternativeNumber: user.alternativeContactNumber,
|
|
|
|
|
|
|
|
departmentName: user.departmentName,
|
|
|
|
|
|
|
|
designation: user.desginationName,
|
|
|
|
|
|
|
|
reportingManager: user.reportingManager,
|
|
|
|
|
|
|
|
city: user.city,
|
|
|
|
|
|
|
|
zone: user.zone,
|
|
|
|
|
|
|
|
address1: user.address1,
|
|
|
|
|
|
|
|
address2: user.address2,
|
|
|
|
|
|
|
|
profile: {
|
|
|
|
|
|
|
|
state: user.state,
|
|
|
|
|
|
|
|
country: user.country,
|
|
|
|
|
|
|
|
//role: type, // Store type in profile.role
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// return reply.send(survey);
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Login Error:", error);
|
|
|
|
console.error("Login Error:", error);
|
|
|
|
return reply.code(500).send({ message: "Internal server error" });
|
|
|
|
return reply.code(500).send({ message: "Internal server error" });
|
|
|
|