feat: add appointment notification sharing functionality via WhatsApp, email, and system clipboard
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
AppointmentAdminByDateView,
|
||||
CreateAppointmentParams,
|
||||
CreateImmediateAppointmentNotificationJobsParams,
|
||||
AppointmentNotificationPreviewParams,
|
||||
AppointmentNotificationPreviewResult,
|
||||
DeleteAppointmentParams,
|
||||
FindAppointmentsParams,
|
||||
FindAppointmentSchedulesParams,
|
||||
@@ -368,6 +370,27 @@ export class CreateImmediateAppointmentNotificationJobsController extends Contro
|
||||
}
|
||||
}
|
||||
|
||||
@Route("appointments/notification-preview")
|
||||
@Middlewares(authenticateMiddleware)
|
||||
export class AppointmentNotificationPreviewController extends Controller {
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post()
|
||||
public async getAppointmentNotificationPreview(
|
||||
@Body() requestBody: AppointmentNotificationPreviewParams
|
||||
): Promise<AppointmentNotificationPreviewResult | ApiValidationError> {
|
||||
try {
|
||||
const preview = await new AppointmentService().getAppointmentNotificationPreview(requestBody);
|
||||
this.setStatus(200);
|
||||
return preview;
|
||||
} 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 {
|
||||
|
||||
@@ -2,6 +2,8 @@ import { TextObjectFilterResult } from "../../Models/TextObjectFilter.model";
|
||||
import AppointmentList from "../../Models/Appointments/Appointments";
|
||||
import {
|
||||
CreateImmediateAppointmentNotificationJobsParams,
|
||||
AppointmentNotificationPreviewParams,
|
||||
AppointmentNotificationPreviewResult,
|
||||
AppointmentAdminByClientView,
|
||||
AppointmentAdminByDateView,
|
||||
CreateAppointmentParams,
|
||||
@@ -167,6 +169,11 @@ export class AppointmentService {
|
||||
await AppointmentList.createImmediateNotificationJobs(data);
|
||||
}
|
||||
|
||||
public async getAppointmentNotificationPreview(data: AppointmentNotificationPreviewParams): Promise<AppointmentNotificationPreviewResult> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
return AppointmentList.getAppointmentNotificationPreview(data);
|
||||
}
|
||||
|
||||
public async applyDiscount(data: ApplyAppointmentDiscountParams): Promise<void> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await AppointmentList.applyDiscount(data);
|
||||
|
||||
Reference in New Issue
Block a user