From 23db497730a30bcfa000376793c5f174d512ce83 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 22 Jul 2026 10:16:53 -0500 Subject: [PATCH] fix: include id and phone in professionals.users for findById MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/src/services/services.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/services/services.service.ts b/backend/src/services/services.service.ts index 0bd9cec..debae94 100644 --- a/backend/src/services/services.service.ts +++ b/backend/src/services/services.service.ts @@ -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');