feat: implement collaborator reactivation logic, add access denied handling, and improve metric filtering
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user