fix: include id and phone in professionals.users for findById

The findById endpoint only selected {name, picture} from professionals.users,
so when a patient viewed a service detail the professional's id and phone
were missing. This caused:
- The call button to be hidden (phone was null)
- The chat route to be built with an empty professional ID ('/chat/')
  making the Firestore stream unable to find the chat → spinner forever

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-22 10:16:53 -05:00
co-authored by Claude Sonnet 4.6
parent b4857dbc75
commit 23db497730
+3 -1
View File
@@ -247,8 +247,10 @@ export class ServicesService {
const service = await this.prisma.services.findUnique({
where: { id },
include: {
// Patient data (for professional viewing the service)
users: { select: { id: true, name: true, picture: true, phone: true } },
professionals: { include: { users: { select: { name: true, picture: true } } } },
// Professional data (for patient viewing the service — needs id and phone for chat/call)
professionals: { include: { users: { select: { id: true, name: true, picture: true, phone: true } } } },
},
});
if (!service) throw new NotFoundException('Servicio no encontrado');