feat: add collaboratorUserId to appointment model and update dashboard filtering logic

This commit is contained in:
2026-07-21 10:34:52 -03:00
parent a9afb13d15
commit 40090cdec5
4 changed files with 10 additions and 2 deletions
@@ -245,6 +245,7 @@ export interface AppointmentEventByClient {
serviceName: string; serviceName: string;
serviceDescription: string; serviceDescription: string;
collaboratorId: string; collaboratorId: string;
collaboratorUserId: string;
collaboratorName: string; collaboratorName: string;
collaboratorAvatar: string; collaboratorAvatar: string;
appointmentDate: string; appointmentDate: string;
@@ -1313,6 +1313,7 @@ class AppointmentManager implements IAppointmentsManager {
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: employee.id, collaboratorId: employee.id,
collaboratorUserId: String(employee.userId),
collaboratorName: collaboratorFullName, collaboratorName: collaboratorFullName,
collaboratorAvatar: collaboratorAvatar, collaboratorAvatar: collaboratorAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -1422,6 +1423,7 @@ class AppointmentManager implements IAppointmentsManager {
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: employee.id, collaboratorId: employee.id,
collaboratorUserId: String(employee.userId),
collaboratorName: employeeFullName, collaboratorName: employeeFullName,
collaboratorAvatar: employeeAvatar, collaboratorAvatar: employeeAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -1531,6 +1533,7 @@ class AppointmentManager implements IAppointmentsManager {
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: employee.id, collaboratorId: employee.id,
collaboratorUserId: String(employee.userId),
collaboratorName: employeeFullName, collaboratorName: employeeFullName,
collaboratorAvatar: employeeAvatar, collaboratorAvatar: employeeAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -1649,6 +1652,7 @@ class AppointmentManager implements IAppointmentsManager {
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: String(employee.id || (employee as any)._id), collaboratorId: String(employee.id || (employee as any)._id),
collaboratorUserId: String(employee.userId),
collaboratorName: employeeFullName, collaboratorName: employeeFullName,
collaboratorAvatar: employeeAvatar, collaboratorAvatar: employeeAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -1766,6 +1770,7 @@ class AppointmentManager implements IAppointmentsManager {
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: employee.id, collaboratorId: employee.id,
collaboratorUserId: String(employee.userId),
collaboratorName: employeeFullName, collaboratorName: employeeFullName,
collaboratorAvatar: employeeAvatar, collaboratorAvatar: employeeAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -1893,6 +1898,7 @@ public async findAppointmentsByCollaboratorPaginated(
serviceName: service.name, serviceName: service.name,
serviceDescription: service.description, serviceDescription: service.description,
collaboratorId: String(employee.id || (employee as any)._id), collaboratorId: String(employee.id || (employee as any)._id),
collaboratorUserId: String(employee.userId),
collaboratorName: employeeFullName, collaboratorName: employeeFullName,
collaboratorAvatar: employeeAvatar, collaboratorAvatar: employeeAvatar,
appointmentDate: dayjs(appointment.start).toISOString(), appointmentDate: dayjs(appointment.start).toISOString(),
@@ -152,6 +152,7 @@ export interface AppointmentEventByClient {
serviceName: string; serviceName: string;
serviceDescription: string; serviceDescription: string;
collaboratorId: string; collaboratorId: string;
collaboratorUserId: string;
collaboratorName: string; collaboratorName: string;
collaboratorAvatar: string; collaboratorAvatar: string;
appointmentDate: string; appointmentDate: string;
+2 -2
View File
@@ -343,7 +343,7 @@ function DashboardContent() {
); );
const showNoOrganizationStarterContent = Boolean(displayedPlan && organizations.length === 0); const showNoOrganizationStarterContent = Boolean(displayedPlan && organizations.length === 0);
const agendaItems = dashboardData?.personalAgenda ?? []; 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 ( return (
<ThemeProvider theme={turnosXpressTheme}> <ThemeProvider theme={turnosXpressTheme}>
@@ -601,7 +601,7 @@ function DashboardContent() {
<h3 style={{ margin: 0 }}> <h3 style={{ margin: 0 }}>
{showOnlyMine ? "Mi Agenda de Hoy" : "Agenda General de Hoy"} {showOnlyMine ? "Mi Agenda de Hoy" : "Agenda General de Hoy"}
</h3> </h3>
<span className={style.agendaCounter}>{agendaItems.length}</span> <span className={style.agendaCounter}>{filteredAgendaItems.length}</span>
</div> </div>
<span className={style.agendaToggleIcon}>{isAgendaCollapsed ? "+" : ""}</span> <span className={style.agendaToggleIcon}>{isAgendaCollapsed ? "+" : ""}</span>
</button> </button>