|
|
|
@ -270,6 +270,7 @@ fastify.post("/api/login", {
|
|
|
|
|
for (const currentUser of allUsers) {
|
|
|
|
|
const staffMember = currentUser.staff.staff.find(staff => staff.phone === phone && staff.status === "active");
|
|
|
|
|
if (staffMember && staffMember.password === password) {
|
|
|
|
|
|
|
|
|
|
const token = fastify.jwt.sign(
|
|
|
|
|
{
|
|
|
|
|
name: staffMember.name,
|
|
|
|
@ -286,7 +287,21 @@ fastify.post("/api/login", {
|
|
|
|
|
name: staffMember.name,
|
|
|
|
|
phone: staffMember.phone,
|
|
|
|
|
customerId: currentUser.customerId,
|
|
|
|
|
|
|
|
|
|
buildingName: currentUser.buildingName,
|
|
|
|
|
email: currentUser.emails,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
address1: currentUser.address1,
|
|
|
|
|
address2: currentUser.address2,
|
|
|
|
|
phoneVerified: true,
|
|
|
|
|
|
|
|
|
|
latitude: currentUser.latitude,
|
|
|
|
|
longitude: currentUser.longitude,
|
|
|
|
|
type: "staff",
|
|
|
|
|
message: "Staff login successful",
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|