feat: implement collaborator reactivation logic, add access denied handling, and improve metric filtering

This commit is contained in:
2026-07-19 18:56:39 -03:00
parent af6c87acb6
commit 74d6ee6706
27 changed files with 3148 additions and 37 deletions
@@ -25,6 +25,7 @@ import {
PaginatedAppointmentEventByClientResult,
} from "../../Models/Appointments/Appointments.Interface";
import { connect } from "mongoose";
import { validatePermissionsByCompany } from "../../helpers/check";
export class AppointmentService {
public async createAppointment(data: CreateAppointmentParams): Promise<IAppointment> {
@@ -63,6 +64,15 @@ export class AppointmentService {
): Promise<AppointmentAdminByDateView> {
await connect(`${process.env.DATABASE_CONNECTION}`);
if (!data.companyId || !data.sessionUser) {
throw new Error("No se ha encontrado la organización o el usuario de sesión");
}
await validatePermissionsByCompany({
companyId: data.companyId,
sessionUser: data.sessionUser,
});
const appointments = await AppointmentList.findAppointmentsAdminByDate(data);
return appointments;