@blackcode_sa/metaestetics-api 1.14.61 → 1.14.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.js +418 -781
- package/dist/admin/index.mjs +418 -781
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
- package/src/admin/mailing/appointment/appointment.mailing.service.ts +430 -793
- package/src/services/appointment/appointment.service.ts +14 -2
|
@@ -680,11 +680,23 @@ export class AppointmentService extends BaseService {
|
|
|
680
680
|
|
|
681
681
|
/**
|
|
682
682
|
* Cancels an appointment by an Admin/Clinic.
|
|
683
|
+
* @param appointmentId - The appointment ID to cancel
|
|
684
|
+
* @param reasonOrClinicId - Either a cancellation reason string, or clinicId (legacy parameter - will be ignored)
|
|
683
685
|
*/
|
|
684
|
-
async cancelAppointmentAdmin(appointmentId: string,
|
|
686
|
+
async cancelAppointmentAdmin(appointmentId: string, reasonOrClinicId?: string): Promise<Appointment> {
|
|
685
687
|
console.log(`[APPOINTMENT_SERVICE] Admin canceling appointment: ${appointmentId}`);
|
|
688
|
+
|
|
689
|
+
// Detect if the second parameter looks like an ID rather than a reason
|
|
690
|
+
// IDs typically have no spaces and contain alphanumeric/dash/underscore patterns
|
|
691
|
+
const isLikelyId = reasonOrClinicId &&
|
|
692
|
+
!reasonOrClinicId.includes(' ') &&
|
|
693
|
+
/^[a-zA-Z0-9_-]+$/.test(reasonOrClinicId) &&
|
|
694
|
+
reasonOrClinicId.length > 15;
|
|
695
|
+
|
|
696
|
+
const cancellationReason = isLikelyId ? undefined : (reasonOrClinicId || undefined);
|
|
697
|
+
|
|
686
698
|
return this.updateAppointmentStatus(appointmentId, AppointmentStatus.CANCELED_CLINIC, {
|
|
687
|
-
cancellationReason
|
|
699
|
+
cancellationReason,
|
|
688
700
|
canceledBy: 'clinic',
|
|
689
701
|
});
|
|
690
702
|
}
|