support login

master^2
Bhaskar 5 months ago
parent 2e5d6fbb84
commit 1872c9ae35

@ -1533,16 +1533,30 @@ fastify.post("/api/teamMemberLogin", {
summary: "Login for Support TeamMember",
body: {
type: "object",
required: ["phone", "password"],
required: ["type", "phone", "password"],
properties: {
phone: { type: "string", description: "Registered phone number" },
password: { type: "string", description: "Password for authentication" },
},
},
type: {
type: "string",
description: "Role type of the user (e.g., 'team_member')"
},
phone: {
type: "string",
description: "Registered phone number of the team member"
},
password: {
type: "string",
description: "Password for authentication"
}
}
}
},
async handler(req, reply) {
try {
const { phone, password } = req.body;
const { type, phone, password } = req.body;
if (type !== "Support_TeamMember") {
return reply.code(400).send({ error: "Invalid user type" });
}
const support = await Support.findOne({
"team_member.team_member.phone": phone
@ -1573,7 +1587,8 @@ fastify.post("/api/teamMemberLogin", {
{
support_teamMemberId: teamMember.support_teamMemberId,
name: teamMember.name,
phone: teamMember.phone
phone: teamMember.phone,
type: "Support_TeamMember"
},
"JWT_SECRET",
{ expiresIn: '7d' }
@ -1594,6 +1609,7 @@ fastify.post("/api/teamMemberLogin", {
});
fastify.post("/api/storelogin", {
schema: {
description: "This is for Store Login",

Loading…
Cancel
Save