name adde in team member login

master^2
Bhaskar 7 months ago
parent b9438b9322
commit de81793c5d

@ -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,

@ -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" }
);

@ -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", },

Loading…
Cancel
Save