From d73fef94faaf0bd05109404239109ec892647a92 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Tue, 4 Mar 2025 12:15:36 +0530 Subject: [PATCH] survey login changes --- src/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 2b06d748..65125233 100644 --- a/src/index.js +++ b/src/index.js @@ -1138,6 +1138,7 @@ fastify.post("/api/installLogin", { // Check if user exists in the Department Schema const user = await Deparments.findOne({ phone }); + console.log("user", user) if (!user) { return reply.code(400).send({ message: "User not found" }); @@ -1155,7 +1156,7 @@ fastify.post("/api/installLogin", { if (!survey) { survey = new Survey({ phone: user.phone, - surveyId: user.surveyId, + surveyId: user.departmentId, firstName: user.firstName, lastName: user.lastName, email: user.email, @@ -1178,7 +1179,7 @@ fastify.post("/api/installLogin", { } const token = fastify.jwt.sign( - { phone: user.phone, surveyId: user.surveyId }, + { phone: user.phone }, "Scret", { expiresIn: "1h" } ); @@ -1188,8 +1189,8 @@ fastify.post("/api/installLogin", { error: false, message: "Login successful", access_token: token, - phone: user.phone, - surveyId: user.surveyId, + phone: user.phone, + surveyId: user.departmentId, firstName: user.firstName, lastName: user.lastName, email: user.email,