|
|
@ -1533,16 +1533,30 @@ fastify.post("/api/teamMemberLogin", {
|
|
|
|
summary: "Login for Support TeamMember",
|
|
|
|
summary: "Login for Support TeamMember",
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
type: "object",
|
|
|
|
required: ["phone", "password"],
|
|
|
|
required: ["type", "phone", "password"],
|
|
|
|
properties: {
|
|
|
|
properties: {
|
|
|
|
phone: { type: "string", description: "Registered phone number" },
|
|
|
|
type: {
|
|
|
|
password: { type: "string", description: "Password for authentication" },
|
|
|
|
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) {
|
|
|
|
async handler(req, reply) {
|
|
|
|
try {
|
|
|
|
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({
|
|
|
|
const support = await Support.findOne({
|
|
|
|
"team_member.team_member.phone": phone
|
|
|
|
"team_member.team_member.phone": phone
|
|
|
@ -1573,7 +1587,8 @@ fastify.post("/api/teamMemberLogin", {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
support_teamMemberId: teamMember.support_teamMemberId,
|
|
|
|
support_teamMemberId: teamMember.support_teamMemberId,
|
|
|
|
name: teamMember.name,
|
|
|
|
name: teamMember.name,
|
|
|
|
phone: teamMember.phone
|
|
|
|
phone: teamMember.phone,
|
|
|
|
|
|
|
|
type: "Support_TeamMember"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"JWT_SECRET",
|
|
|
|
"JWT_SECRET",
|
|
|
|
{ expiresIn: '7d' }
|
|
|
|
{ expiresIn: '7d' }
|
|
|
@ -1593,6 +1608,7 @@ fastify.post("/api/teamMemberLogin", {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.post("/api/storelogin", {
|
|
|
|
fastify.post("/api/storelogin", {
|
|
|
|
schema: {
|
|
|
|
schema: {
|
|
|
|