From 40090cdec5fa56e4d543b238185a4196ca4dc3a0 Mon Sep 17 00:00:00 2001 From: Horacio Daniel Ros Date: Tue, 21 Jul 2026 10:34:52 -0300 Subject: [PATCH] feat: add collaboratorUserId to appointment model and update dashboard filtering logic --- server/src/Models/Appointments/Appointments.Interface.ts | 1 + server/src/Models/Appointments/Appointments.ts | 6 ++++++ txclient/src/Models/Appointments.model.ts | 1 + txclient/src/app/landing/dashboard/page.tsx | 4 ++-- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/src/Models/Appointments/Appointments.Interface.ts b/server/src/Models/Appointments/Appointments.Interface.ts index 3764a31..a747015 100644 --- a/server/src/Models/Appointments/Appointments.Interface.ts +++ b/server/src/Models/Appointments/Appointments.Interface.ts @@ -245,6 +245,7 @@ export interface AppointmentEventByClient { serviceName: string; serviceDescription: string; collaboratorId: string; + collaboratorUserId: string; collaboratorName: string; collaboratorAvatar: string; appointmentDate: string; diff --git a/server/src/Models/Appointments/Appointments.ts b/server/src/Models/Appointments/Appointments.ts index 3d9dce7..493f978 100644 --- a/server/src/Models/Appointments/Appointments.ts +++ b/server/src/Models/Appointments/Appointments.ts @@ -1313,6 +1313,7 @@ class AppointmentManager implements IAppointmentsManager { serviceName: service.name, serviceDescription: service.description, collaboratorId: employee.id, + collaboratorUserId: String(employee.userId), collaboratorName: collaboratorFullName, collaboratorAvatar: collaboratorAvatar, appointmentDate: dayjs(appointment.start).toISOString(), @@ -1422,6 +1423,7 @@ class AppointmentManager implements IAppointmentsManager { serviceName: service.name, serviceDescription: service.description, collaboratorId: employee.id, + collaboratorUserId: String(employee.userId), collaboratorName: employeeFullName, collaboratorAvatar: employeeAvatar, appointmentDate: dayjs(appointment.start).toISOString(), @@ -1531,6 +1533,7 @@ class AppointmentManager implements IAppointmentsManager { serviceName: service.name, serviceDescription: service.description, collaboratorId: employee.id, + collaboratorUserId: String(employee.userId), collaboratorName: employeeFullName, collaboratorAvatar: employeeAvatar, appointmentDate: dayjs(appointment.start).toISOString(), @@ -1649,6 +1652,7 @@ class AppointmentManager implements IAppointmentsManager { serviceName: service.name, serviceDescription: service.description, collaboratorId: String(employee.id || (employee as any)._id), + collaboratorUserId: String(employee.userId), collaboratorName: employeeFullName, collaboratorAvatar: employeeAvatar, appointmentDate: dayjs(appointment.start).toISOString(), @@ -1766,6 +1770,7 @@ class AppointmentManager implements IAppointmentsManager { serviceName: service.name, serviceDescription: service.description, collaboratorId: employee.id, + collaboratorUserId: String(employee.userId), collaboratorName: employeeFullName, collaboratorAvatar: employeeAvatar, appointmentDate: dayjs(appointment.start).toISOString(), @@ -1893,6 +1898,7 @@ public async findAppointmentsByCollaboratorPaginated( serviceName: service.name, serviceDescription: service.description, collaboratorId: String(employee.id || (employee as any)._id), + collaboratorUserId: String(employee.userId), collaboratorName: employeeFullName, collaboratorAvatar: employeeAvatar, appointmentDate: dayjs(appointment.start).toISOString(), diff --git a/txclient/src/Models/Appointments.model.ts b/txclient/src/Models/Appointments.model.ts index 94cfe7d..624bedb 100644 --- a/txclient/src/Models/Appointments.model.ts +++ b/txclient/src/Models/Appointments.model.ts @@ -152,6 +152,7 @@ export interface AppointmentEventByClient { serviceName: string; serviceDescription: string; collaboratorId: string; + collaboratorUserId: string; collaboratorName: string; collaboratorAvatar: string; appointmentDate: string; diff --git a/txclient/src/app/landing/dashboard/page.tsx b/txclient/src/app/landing/dashboard/page.tsx index afbfd12..14ec65a 100644 --- a/txclient/src/app/landing/dashboard/page.tsx +++ b/txclient/src/app/landing/dashboard/page.tsx @@ -343,7 +343,7 @@ function DashboardContent() { ); const showNoOrganizationStarterContent = Boolean(displayedPlan && organizations.length === 0); const agendaItems = dashboardData?.personalAgenda ?? []; - const filteredAgendaItems = agendaItems.filter(item => !showOnlyMine || item.collaboratorId === SessionInfo.userId); + const filteredAgendaItems = agendaItems.filter(item => !showOnlyMine || item.collaboratorUserId === SessionInfo.userId); return ( @@ -601,7 +601,7 @@ function DashboardContent() {

{showOnlyMine ? "Mi Agenda de Hoy" : "Agenda General de Hoy"}

- {agendaItems.length} + {filteredAgendaItems.length} {isAgendaCollapsed ? "+" : "−"}