first commit
This commit is contained in:
@@ -0,0 +1,462 @@
|
||||
import { ApiValidationError } from "../../Models/Server.Error.model";
|
||||
import { Body, Controller, Middlewares, Post, Response, Route, SuccessResponse } from "tsoa";
|
||||
import { authenticateMiddleware } from "../../middleware/authentication";
|
||||
import {
|
||||
AppointmentAdminByClientView,
|
||||
AppointmentAdminByDateView,
|
||||
CreateAppointmentParams,
|
||||
DeleteAppointmentParams,
|
||||
FindAppointmentsParams,
|
||||
FindAppointmentSchedulesParams,
|
||||
IAppointment,
|
||||
UpdateAppointmentParams, MoveAppointmentParams, ChangeServiceParams,
|
||||
FindAppointmentsByUserParams,
|
||||
FindAppointmentsByCollaboratorParams,
|
||||
SendAppointmentNotificationParams,
|
||||
GetAppointmentEventParams,
|
||||
AppointmentEventByClient,
|
||||
ApplyAppointmentDiscountParams,
|
||||
DeleteAppointmentDiscountParams,
|
||||
SendWapSystemNotificationParams,
|
||||
GetAvailableDatesParams,
|
||||
GetAvailableDatesResult,
|
||||
FindAppointmentsByUserPaginatedParams,
|
||||
FindAppointmentsByCollaboratorPaginatedParams,
|
||||
PaginatedAppointmentEventByClientResult,
|
||||
} from "../../Models/Appointments/Appointments.Interface";
|
||||
import { AppointmentService } from "./Appointments.Service";
|
||||
import { ApiVoidResult } from "../../Models/Api.VoidResult.type";
|
||||
import { TextObjectFilterResult } from "../../Models/TextObjectFilter.model";
|
||||
import { rateLimiter } from "../../middleware/ratelimiter";
|
||||
|
||||
@Route("appointments/create")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class CreateAppointmentController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El empleado fue creado con exito")
|
||||
@Post()
|
||||
public async createAppointment(
|
||||
@Body() requestBody: CreateAppointmentParams
|
||||
): Promise<IAppointment | ApiValidationError> {
|
||||
try {
|
||||
const client = await new AppointmentService().createAppointment(requestBody);
|
||||
this.setStatus(200);
|
||||
return client;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/update")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class UpdateAppointmentController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El empleado fue creado con exito")
|
||||
@Post()
|
||||
public async updateAppointment(
|
||||
@Body() requestBody: UpdateAppointmentParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().updateAppointment(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/delete")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class DeleteAppointmentController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El turno fue cancelado con exito")
|
||||
@Post()
|
||||
public async deleteAppointment(
|
||||
@Body() requestBody: DeleteAppointmentParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().deleteAppointment(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-admin-by-date")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentAdminByDateController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El empleado fue creado con exito")
|
||||
@Post()
|
||||
public async findAppointmentAdminByDate(
|
||||
@Body() requestBody: FindAppointmentsParams
|
||||
): Promise<AppointmentAdminByDateView | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsAdminByDate(
|
||||
requestBody
|
||||
);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/get-event")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class GetAppointmentEventController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async getAppointmentEvent(
|
||||
@Body() requestBody: GetAppointmentEventParams
|
||||
): Promise<AppointmentEventByClient | ApiValidationError> {
|
||||
try {
|
||||
const appointment = await new AppointmentService().getAppointmentEvent(requestBody);
|
||||
this.setStatus(200);
|
||||
return appointment;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-admin-by-client")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentAdminByClientController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El empleado fue creado con exito")
|
||||
@Post()
|
||||
public async findAppointmentAdminByClient(
|
||||
@Body() requestBody: FindAppointmentsParams
|
||||
): Promise<AppointmentAdminByClientView | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsAdminByClient(
|
||||
requestBody
|
||||
);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-by-user")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentByUserController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El empleado fue creado con exito")
|
||||
@Post()
|
||||
public async findAppointmentByUser(
|
||||
@Body() requestBody: FindAppointmentsByUserParams
|
||||
): Promise<AppointmentAdminByClientView | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsByUser(requestBody);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-by-collaborator")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentByCollaboratorController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Busqueda completada con exito")
|
||||
@Post()
|
||||
public async findAppointmentByCollaborator(
|
||||
@Body() requestBody: FindAppointmentsByCollaboratorParams
|
||||
): Promise<AppointmentAdminByClientView | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsByCollaborator(requestBody);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-by-user-paginated")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentByUserPaginatedController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Busqueda completada con exito")
|
||||
@Post()
|
||||
public async findAppointmentByUserPaginated(
|
||||
@Body() requestBody: FindAppointmentsByUserPaginatedParams
|
||||
): Promise<PaginatedAppointmentEventByClientResult | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsByUserPaginated(requestBody);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/find-by-collaborator-paginated")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class FindAppointmentByCollaboratorPaginatedController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Busqueda completada con exito")
|
||||
@Post()
|
||||
public async findAppointmentByCollaboratorPaginated(
|
||||
@Body() requestBody: FindAppointmentsByCollaboratorPaginatedParams
|
||||
): Promise<PaginatedAppointmentEventByClientResult | ApiValidationError> {
|
||||
try {
|
||||
const appointments = await new AppointmentService().findAppointmentsByCollaboratorPaginated(requestBody);
|
||||
this.setStatus(200);
|
||||
return appointments;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/get-schedules")
|
||||
export class GetSchedulesController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async findSchedules(
|
||||
@Body() requestBody: FindAppointmentSchedulesParams
|
||||
): Promise<TextObjectFilterResult[] | ApiValidationError> {
|
||||
try {
|
||||
const schedules = await new AppointmentService().getSchedules(requestBody);
|
||||
this.setStatus(200);
|
||||
return schedules;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/send-wap-notification")
|
||||
@Middlewares(rateLimiter)
|
||||
export class SendWapNotificationContrnoller extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async findSchedules(
|
||||
@Body() requestBody: SendAppointmentNotificationParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().sendWapNotification(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/send-wap-sys-notification")
|
||||
@Middlewares(rateLimiter)
|
||||
export class SendWapSystemNotificationContrnoller extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async sendWapSystemNtofication(
|
||||
@Body() requestBody: SendWapSystemNotificationParams
|
||||
): Promise<ApiVoidResult> {
|
||||
try {
|
||||
await new AppointmentService().sendWapSystemNotification(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
message: `${e}`,
|
||||
success: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/send-email-notification")
|
||||
@Middlewares(rateLimiter)
|
||||
export class SendEmailNotificationContrnoller extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async findSchedules(
|
||||
@Body() requestBody: SendAppointmentNotificationParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().sendEmailNotification(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/apply-discount")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class ApplyAppointmentDiscountContrnoller extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async applyAppointmentDiscount(
|
||||
@Body() requestBody: ApplyAppointmentDiscountParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().applyDiscount(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/delete-discount")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class DeleteAppointmentDiscountContrnoller extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async deleteAppointmentDiscount(
|
||||
@Body() requestBody: DeleteAppointmentDiscountParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().deleteDiscount(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/get-available-dates")
|
||||
export class GetAvailableDatesController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async getAvailableDates(
|
||||
@Body() requestBody: GetAvailableDatesParams
|
||||
): Promise<GetAvailableDatesResult | ApiValidationError> {
|
||||
try {
|
||||
const schedules = await new AppointmentService().getAvailableDates(requestBody);
|
||||
this.setStatus(200);
|
||||
return schedules;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/move-appointment-force")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class MoveAppointmentForceController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El turno fue movido con exito")
|
||||
@Post()
|
||||
public async moveAppointmentForce(
|
||||
@Body() requestBody: MoveAppointmentParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().moveAppointmentForce(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/change-service-force")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class ChangeServiceForceController extends Controller {
|
||||
/**
|
||||
* @summary Permite cambiar el servicio de un turno sin validar horarios (force).
|
||||
*/
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "El servicio del turno fue cambiado con exito")
|
||||
@Post()
|
||||
public async changeServiceForce(
|
||||
@Body() requestBody: ChangeServiceParams
|
||||
): Promise<ApiVoidResult | ApiValidationError> {
|
||||
try {
|
||||
await new AppointmentService().changeServiceForce(requestBody);
|
||||
this.setStatus(200);
|
||||
return {
|
||||
message: "Done",
|
||||
success: true,
|
||||
};
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error; console.error("GET EVENT ERROR:", errorOccurred);
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
import { TextObjectFilterResult } from "../../Models/TextObjectFilter.model";
|
||||
import AppointmentList from "../../Models/Appointments/Appointments";
|
||||
import {
|
||||
AppointmentAdminByClientView,
|
||||
AppointmentAdminByDateView,
|
||||
CreateAppointmentParams,
|
||||
MoveAppointmentParams, ChangeServiceParams,
|
||||
DeleteAppointmentParams,
|
||||
FindAppointmentsParams,
|
||||
FindAppointmentSchedulesParams,
|
||||
IAppointment,
|
||||
UpdateAppointmentParams,
|
||||
FindAppointmentsByUserParams,
|
||||
FindAppointmentsByCollaboratorParams,
|
||||
SendAppointmentNotificationParams,
|
||||
GetAppointmentEventParams,
|
||||
AppointmentEventByClient,
|
||||
ApplyAppointmentDiscountParams,
|
||||
DeleteAppointmentDiscountParams,
|
||||
SendWapSystemNotificationParams,
|
||||
GetAvailableDatesParams,
|
||||
GetAvailableDatesResult,
|
||||
FindAppointmentsByUserPaginatedParams,
|
||||
FindAppointmentsByCollaboratorPaginatedParams,
|
||||
PaginatedAppointmentEventByClientResult,
|
||||
} from "../../Models/Appointments/Appointments.Interface";
|
||||
import { connect } from "mongoose";
|
||||
|
||||
export class AppointmentService {
|
||||
public async createAppointment(data: CreateAppointmentParams): Promise<IAppointment> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const newAppointment = await AppointmentList.createAppointment(data);
|
||||
|
||||
return newAppointment;
|
||||
}
|
||||
|
||||
|
||||
public async moveAppointmentForce(data: MoveAppointmentParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.moveAppointmentForce(data);
|
||||
}
|
||||
|
||||
public async changeServiceForce(data: ChangeServiceParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.changeServiceForce(data);
|
||||
}
|
||||
|
||||
public async updateAppointment(data: UpdateAppointmentParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
await AppointmentList.updateAppointment(data);
|
||||
}
|
||||
|
||||
public async deleteAppointment(data: DeleteAppointmentParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
await AppointmentList.deleteAppointment(data);
|
||||
}
|
||||
|
||||
public async findAppointmentsAdminByDate(
|
||||
data: FindAppointmentsParams
|
||||
): Promise<AppointmentAdminByDateView> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsAdminByDate(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async getAppointmentEvent(
|
||||
data: GetAppointmentEventParams
|
||||
): Promise<AppointmentEventByClient> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointment = await AppointmentList.getAppointmentEvent(data);
|
||||
|
||||
return appointment;
|
||||
}
|
||||
|
||||
public async findAppointmentsAdminByClient(
|
||||
data: FindAppointmentsParams
|
||||
): Promise<AppointmentAdminByClientView> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsAdminByClient(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async findAppointmentsByUser(
|
||||
data: FindAppointmentsByUserParams
|
||||
): Promise<AppointmentAdminByClientView> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsByUser(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async findAppointmentsByCollaborator(
|
||||
data: FindAppointmentsByCollaboratorParams
|
||||
): Promise<AppointmentAdminByClientView> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsByCollaborator(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async findAppointmentsByUserPaginated(
|
||||
data: FindAppointmentsByUserPaginatedParams
|
||||
): Promise<PaginatedAppointmentEventByClientResult> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsByUserPaginated(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async findAppointmentsByCollaboratorPaginated(
|
||||
data: FindAppointmentsByCollaboratorPaginatedParams
|
||||
): Promise<PaginatedAppointmentEventByClientResult> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
|
||||
const appointments = await AppointmentList.findAppointmentsByCollaboratorPaginated(data);
|
||||
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public async getSchedules(
|
||||
data: FindAppointmentSchedulesParams
|
||||
): Promise<TextObjectFilterResult[]> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
const schedules = await AppointmentList.getSchedules(data);
|
||||
return schedules;
|
||||
}
|
||||
|
||||
public async sendWapNotification(data: SendAppointmentNotificationParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.sendWapNotification(data);
|
||||
}
|
||||
|
||||
public async sendWapSystemNotification(data: SendWapSystemNotificationParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.sendWapSystemNotification(data);
|
||||
}
|
||||
|
||||
public async sendEmailNotification(data: SendAppointmentNotificationParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.sendEmailNotification(data);
|
||||
}
|
||||
|
||||
public async applyDiscount(data: ApplyAppointmentDiscountParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.applyDiscount(data);
|
||||
}
|
||||
|
||||
public async deleteDiscount(data: DeleteAppointmentDiscountParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.deleteDiscount(data);
|
||||
}
|
||||
|
||||
public async getAvailableDates(
|
||||
data: GetAvailableDatesParams
|
||||
): Promise<GetAvailableDatesResult> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
return AppointmentList.getAvailableDates(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user