diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index f26a17ab..3ca23dfe 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -28,7 +28,7 @@ const generateTeamMemberId = async () => { exports.createTeamMember = async (request, reply) => { try { - const { installationId, name, phone, password,email,alternativePhone ,status} = request.body; + const { installationId, firstName, phone, password,email,alternativePhone ,status} = request.body; // Check if installation exists const installation = await Install.findOne({ installationId }); @@ -64,7 +64,7 @@ exports.createTeamMember = async (request, reply) => { // Create new team member const newTeamMember = { teamMemberId, - name, + firstName, phone, email, alternativePhone, diff --git a/src/index.js b/src/index.js index f844a558..f7e577b5 100644 --- a/src/index.js +++ b/src/index.js @@ -1058,7 +1058,7 @@ fastify.post("/api/teamMemberLogin", { const teamMember = installation.team_member.team_member.find( (member) => member.phone === phone ); - +console.log(installation.team_member.team_member.firstName) if (!teamMember) { return reply.status(401).send({ simplydata: { @@ -1092,7 +1092,7 @@ fastify.post("/api/teamMemberLogin", { // Generate JWT token const token = fastify.jwt.sign( { phone: teamMember.phone, role: type, installationId }, - process.env.JWT_SECRET, + "JWT_SECRET", { expiresIn: "1h" } ); diff --git a/src/routes/installationRoute.js b/src/routes/installationRoute.js index f6d2bf96..16b7d1a0 100644 --- a/src/routes/installationRoute.js +++ b/src/routes/installationRoute.js @@ -9,10 +9,10 @@ module.exports = function (fastify, opts, next) { summary: "Create Team Member", body: { type: "object", - required: ["installationId", "name", "phone", "password"], + required: ["installationId", "firstName", "phone", "password"], properties: { installationId: { type: "string", description: "Installation ID to associate the team member with" }, - name: { type: "string", description: "Full name of the team member" }, + firstName: { type: "string", description: "Full name of the team member" }, phone: { type: "string", description: "Phone number of the team member" }, password: { type: "string", description: "Password for the team member" }, alternativePhone: { type: "string", },