@blackcode_sa/metaestetics-api 1.7.27 → 1.7.29

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.
@@ -35,8 +35,14 @@ export class ProcedureAggregationService {
35
35
  }
36
36
 
37
37
  const procedureId = procedureSummary.id;
38
+ const clinicId = procedureSummary.clinicId;
39
+ const isFreeConsultation =
40
+ procedureSummary.technologyName === "free-consultation-tech";
41
+
38
42
  console.log(
39
- `[ProcedureAggregationService] Adding procedure ${procedureId} to practitioner ${practitionerId}.`
43
+ `[ProcedureAggregationService] Adding procedure ${procedureId} to practitioner ${practitionerId}. ${
44
+ isFreeConsultation ? "(Free Consultation)" : ""
45
+ }`
40
46
  );
41
47
 
42
48
  const practitionerRef = this.db
@@ -44,11 +50,54 @@ export class ProcedureAggregationService {
44
50
  .doc(practitionerId);
45
51
 
46
52
  try {
47
- await practitionerRef.update({
53
+ // Prepare the basic update data
54
+ const updateData: any = {
48
55
  procedureIds: admin.firestore.FieldValue.arrayUnion(procedureId),
49
56
  proceduresInfo: admin.firestore.FieldValue.arrayUnion(procedureSummary),
50
57
  updatedAt: admin.firestore.FieldValue.serverTimestamp(),
51
- });
58
+ };
59
+
60
+ // If this is a free consultation, we need to update the freeConsultations map
61
+ if (isFreeConsultation) {
62
+ await this.db.runTransaction(async (transaction) => {
63
+ const practitionerDoc = await transaction.get(practitionerRef);
64
+ if (!practitionerDoc.exists) {
65
+ throw new Error(
66
+ `Practitioner ${practitionerId} does not exist for adding free consultation`
67
+ );
68
+ }
69
+
70
+ const practitionerData = practitionerDoc.data();
71
+ const currentFreeConsultations =
72
+ practitionerData?.freeConsultations || {};
73
+
74
+ // Check if there's already a free consultation for this clinic
75
+ if (currentFreeConsultations[clinicId]) {
76
+ console.log(
77
+ `[ProcedureAggregationService] Warning: Clinic ${clinicId} already has a free consultation ${currentFreeConsultations[clinicId]}. Replacing with new one ${procedureId}.`
78
+ );
79
+ }
80
+
81
+ // Set the single procedure ID for this clinic (replaces any existing one)
82
+ const updatedFreeConsultations = {
83
+ ...currentFreeConsultations,
84
+ [clinicId]: procedureId,
85
+ };
86
+
87
+ // Apply all updates including freeConsultations
88
+ transaction.update(practitionerRef, {
89
+ ...updateData,
90
+ freeConsultations: updatedFreeConsultations,
91
+ });
92
+
93
+ console.log(
94
+ `[ProcedureAggregationService] Set free consultation ${procedureId} for practitioner ${practitionerId} at clinic ${clinicId}`
95
+ );
96
+ });
97
+ } else {
98
+ // For regular procedures, just do the standard update
99
+ await practitionerRef.update(updateData);
100
+ }
52
101
 
53
102
  console.log(
54
103
  `[ProcedureAggregationService] Successfully added procedure ${procedureId} to practitioner ${practitionerId}.`
@@ -374,11 +423,13 @@ export class ProcedureAggregationService {
374
423
  * Removes procedure from a practitioner when a procedure is deleted or inactivated
375
424
  * @param practitionerId - ID of the practitioner who performs the procedure
376
425
  * @param procedureId - ID of the procedure
426
+ * @param clinicId - Optional clinic ID for free consultation removal
377
427
  * @returns {Promise<void>}
378
428
  */
379
429
  async removeProcedureFromPractitioner(
380
430
  practitionerId: string,
381
- procedureId: string
431
+ procedureId: string,
432
+ clinicId?: string
382
433
  ): Promise<void> {
383
434
  if (!practitionerId || !procedureId) {
384
435
  console.log(
@@ -414,17 +465,52 @@ export class ProcedureAggregationService {
414
465
  // Get current procedures info array
415
466
  const proceduresInfo = practitionerData.proceduresInfo || [];
416
467
 
468
+ // Find the procedure being removed to check if it's a free consultation
469
+ const procedureBeingRemoved = proceduresInfo.find(
470
+ (p: any) => p.id === procedureId
471
+ );
472
+
473
+ const isFreeConsultation =
474
+ procedureBeingRemoved?.technologyName === "free-consultation-tech";
475
+ const procedureClinicId = clinicId || procedureBeingRemoved?.clinicId;
476
+
417
477
  // Remove the procedure summary
418
478
  const updatedProceduresInfo = proceduresInfo.filter(
419
- (p: ProcedureSummaryInfo) => p.id !== procedureId
479
+ (p: any) => p.id !== procedureId
420
480
  );
421
481
 
422
- // Update the practitioner document
423
- transaction.update(practitionerRef, {
482
+ // Prepare update data
483
+ const updateData: any = {
424
484
  procedureIds: admin.firestore.FieldValue.arrayRemove(procedureId),
425
485
  proceduresInfo: updatedProceduresInfo,
426
486
  updatedAt: admin.firestore.FieldValue.serverTimestamp(),
427
- });
487
+ };
488
+
489
+ // If this is a free consultation, also remove it from the freeConsultations map
490
+ if (isFreeConsultation && procedureClinicId) {
491
+ const currentFreeConsultations =
492
+ practitionerData.freeConsultations || {};
493
+
494
+ // Check if this clinic's free consultation matches the procedure being removed
495
+ if (currentFreeConsultations[procedureClinicId] === procedureId) {
496
+ // Remove the clinic entry from the freeConsultations map
497
+ const updatedFreeConsultations = { ...currentFreeConsultations };
498
+ delete updatedFreeConsultations[procedureClinicId];
499
+
500
+ updateData.freeConsultations = updatedFreeConsultations;
501
+
502
+ console.log(
503
+ `[ProcedureAggregationService] Removed free consultation ${procedureId} from practitioner ${practitionerId} for clinic ${procedureClinicId}`
504
+ );
505
+ } else {
506
+ console.log(
507
+ `[ProcedureAggregationService] Free consultation mismatch for clinic ${procedureClinicId}: expected ${procedureId}, found ${currentFreeConsultations[procedureClinicId]}`
508
+ );
509
+ }
510
+ }
511
+
512
+ // Update the practitioner document
513
+ transaction.update(practitionerRef, updateData);
428
514
  });
429
515
 
430
516
  console.log(
@@ -505,4 +591,112 @@ export class ProcedureAggregationService {
505
591
  throw error;
506
592
  }
507
593
  }
594
+
595
+ /**
596
+ * Handles procedure status changes (activation/deactivation) specifically for free consultations
597
+ * @param practitionerId - ID of the practitioner who performs the procedure
598
+ * @param procedureId - ID of the procedure
599
+ * @param clinicId - ID of the clinic where the procedure is performed
600
+ * @param isActive - New active status of the procedure
601
+ * @param technologyName - Technology name of the procedure (to check if it's a free consultation)
602
+ * @returns {Promise<void>}
603
+ */
604
+ async handleFreeConsultationStatusChange(
605
+ practitionerId: string,
606
+ procedureId: string,
607
+ clinicId: string,
608
+ isActive: boolean,
609
+ technologyName: string
610
+ ): Promise<void> {
611
+ if (!practitionerId || !procedureId || !clinicId) {
612
+ console.log(
613
+ "[ProcedureAggregationService] Missing required parameters for handling free consultation status change. Skipping."
614
+ );
615
+ return;
616
+ }
617
+
618
+ // Only handle free consultations
619
+ if (technologyName !== "free-consultation-tech") {
620
+ return;
621
+ }
622
+
623
+ console.log(
624
+ `[ProcedureAggregationService] Handling free consultation status change: procedure ${procedureId} for practitioner ${practitionerId} in clinic ${clinicId}. New status: ${
625
+ isActive ? "active" : "inactive"
626
+ }`
627
+ );
628
+
629
+ const practitionerRef = this.db
630
+ .collection(PRACTITIONERS_COLLECTION)
631
+ .doc(practitionerId);
632
+
633
+ try {
634
+ await this.db.runTransaction(async (transaction) => {
635
+ const practitionerDoc = await transaction.get(practitionerRef);
636
+ if (!practitionerDoc.exists) {
637
+ throw new Error(
638
+ `Practitioner ${practitionerId} does not exist for free consultation status change`
639
+ );
640
+ }
641
+
642
+ const practitionerData = practitionerDoc.data();
643
+ if (!practitionerData) {
644
+ throw new Error(
645
+ `Practitioner ${practitionerId} data is empty for free consultation status change`
646
+ );
647
+ }
648
+
649
+ const currentFreeConsultations =
650
+ practitionerData.freeConsultations || {};
651
+ let updatedFreeConsultations = { ...currentFreeConsultations };
652
+
653
+ if (isActive) {
654
+ // If procedure is being activated, set it as the free consultation for this clinic
655
+ if (
656
+ currentFreeConsultations[clinicId] &&
657
+ currentFreeConsultations[clinicId] !== procedureId
658
+ ) {
659
+ console.log(
660
+ `[ProcedureAggregationService] Warning: Clinic ${clinicId} already has a different free consultation ${currentFreeConsultations[clinicId]}. Replacing with ${procedureId}.`
661
+ );
662
+ }
663
+
664
+ updatedFreeConsultations[clinicId] = procedureId;
665
+
666
+ console.log(
667
+ `[ProcedureAggregationService] Set free consultation ${procedureId} for practitioner ${practitionerId} at clinic ${clinicId} (activated)`
668
+ );
669
+ } else {
670
+ // If procedure is being deactivated, remove it from the free consultations map
671
+ if (currentFreeConsultations[clinicId] === procedureId) {
672
+ delete updatedFreeConsultations[clinicId];
673
+
674
+ console.log(
675
+ `[ProcedureAggregationService] Removed free consultation ${procedureId} from practitioner ${practitionerId} for clinic ${clinicId} (deactivated)`
676
+ );
677
+ } else {
678
+ console.log(
679
+ `[ProcedureAggregationService] Free consultation mismatch for clinic ${clinicId}: expected ${procedureId}, found ${currentFreeConsultations[clinicId]}`
680
+ );
681
+ }
682
+ }
683
+
684
+ // Update the practitioner document with the new freeConsultations map
685
+ transaction.update(practitionerRef, {
686
+ freeConsultations: updatedFreeConsultations,
687
+ updatedAt: admin.firestore.FieldValue.serverTimestamp(),
688
+ });
689
+ });
690
+
691
+ console.log(
692
+ `[ProcedureAggregationService] Successfully handled free consultation status change for procedure ${procedureId} of practitioner ${practitionerId}.`
693
+ );
694
+ } catch (error) {
695
+ console.error(
696
+ `[ProcedureAggregationService] Error handling free consultation status change for procedure ${procedureId} of practitioner ${practitionerId}:`,
697
+ error
698
+ );
699
+ throw error;
700
+ }
701
+ }
508
702
  }
@@ -0,0 +1,147 @@
1
+ import * as admin from "firebase-admin";
2
+ import { ProcedureFamily } from "../../backoffice/types/static/procedure-family.types";
3
+ import {
4
+ CertificationLevel,
5
+ CertificationSpecialty,
6
+ } from "../../backoffice/types/static/certification.types";
7
+ import { CATEGORIES_COLLECTION } from "../../backoffice/types/category.types";
8
+ import { SUBCATEGORIES_COLLECTION } from "../../backoffice/types/subcategory.types";
9
+ import { TECHNOLOGIES_COLLECTION } from "../../backoffice/types/technology.types";
10
+
11
+ /**
12
+ * Ensures that the free consultation infrastructure exists in the database
13
+ * Creates category, subcategory, and technology if they don't exist
14
+ * @param db - Firestore database instance (optional, defaults to admin.firestore())
15
+ * @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
16
+ */
17
+ export async function freeConsultationInfrastructure(
18
+ db?: admin.firestore.Firestore
19
+ ): Promise<boolean> {
20
+ const firestore = db || admin.firestore();
21
+
22
+ try {
23
+ console.log(
24
+ "[freeConsultationInfrastructure] Checking free consultation infrastructure..."
25
+ );
26
+
27
+ // Check if the technology already exists
28
+ const technologyRef = firestore
29
+ .collection(TECHNOLOGIES_COLLECTION)
30
+ .doc("free-consultation-tech");
31
+
32
+ const technologyDoc = await technologyRef.get();
33
+
34
+ if (technologyDoc.exists) {
35
+ console.log(
36
+ "[freeConsultationInfrastructure] Free consultation infrastructure already exists"
37
+ );
38
+ return true;
39
+ }
40
+
41
+ console.log(
42
+ "[freeConsultationInfrastructure] Creating free consultation infrastructure..."
43
+ );
44
+
45
+ // Create the infrastructure in the correct order: Category → Subcategory → Technology
46
+ await createFreeConsultationInfrastructure(firestore);
47
+
48
+ console.log(
49
+ "[freeConsultationInfrastructure] Successfully created free consultation infrastructure"
50
+ );
51
+ return true;
52
+ } catch (error) {
53
+ console.error(
54
+ "[freeConsultationInfrastructure] Error ensuring infrastructure:",
55
+ error
56
+ );
57
+ throw error;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Creates the complete free consultation infrastructure
63
+ * @param db - Firestore database instance
64
+ */
65
+ async function createFreeConsultationInfrastructure(
66
+ db: admin.firestore.Firestore
67
+ ): Promise<void> {
68
+ const batch = db.batch();
69
+ const now = new Date();
70
+
71
+ // 1. Create Category: "consultation"
72
+ const categoryRef = db.collection(CATEGORIES_COLLECTION).doc("consultation");
73
+ const categoryData = {
74
+ id: "consultation",
75
+ name: "Consultation",
76
+ description:
77
+ "Professional consultation services for treatment planning and assessment",
78
+ family: ProcedureFamily.AESTHETICS,
79
+ isActive: true,
80
+ createdAt: now,
81
+ updatedAt: now,
82
+ };
83
+ batch.set(categoryRef, categoryData);
84
+
85
+ // 2. Create Subcategory: "free-consultation"
86
+ const subcategoryRef = db
87
+ .collection(CATEGORIES_COLLECTION)
88
+ .doc("consultation")
89
+ .collection(SUBCATEGORIES_COLLECTION)
90
+ .doc("free-consultation");
91
+
92
+ const subcategoryData = {
93
+ id: "free-consultation",
94
+ name: "Free Consultation",
95
+ description:
96
+ "Complimentary initial consultation to discuss treatment options and assess patient needs",
97
+ categoryId: "consultation",
98
+ isActive: true,
99
+ createdAt: now,
100
+ updatedAt: now,
101
+ };
102
+ batch.set(subcategoryRef, subcategoryData);
103
+
104
+ // 3. Create Technology: "free-consultation-tech"
105
+ const technologyRef = db
106
+ .collection(TECHNOLOGIES_COLLECTION)
107
+ .doc("free-consultation-tech");
108
+ const technologyData = {
109
+ id: "free-consultation-tech",
110
+ name: "Free Consultation Technology",
111
+ description:
112
+ "Technology framework for providing free initial consultations to patients",
113
+ family: ProcedureFamily.AESTHETICS,
114
+ categoryId: "consultation",
115
+ subcategoryId: "free-consultation",
116
+ technicalDetails:
117
+ "Standard consultation protocol for initial patient assessment",
118
+ requirements: {
119
+ pre: [], // No pre-requirements for consultation
120
+ post: [], // No post-requirements for consultation
121
+ },
122
+ blockingConditions: [], // No blocking conditions for consultation
123
+ contraindications: [], // No contraindications for consultation
124
+ benefits: [
125
+ "IMPROVED_PATIENT_UNDERSTANDING",
126
+ "BETTER_TREATMENT_PLANNING",
127
+ "ENHANCED_PATIENT_CONFIDENCE",
128
+ ],
129
+ certificationRequirement: {
130
+ minimumLevel: CertificationLevel.AESTHETICIAN,
131
+ requiredSpecialties: [], // No required specialties for consultation
132
+ },
133
+ documentationTemplates: [],
134
+ isActive: true,
135
+ createdAt: now,
136
+ updatedAt: now,
137
+ };
138
+ batch.set(technologyRef, technologyData);
139
+
140
+ // Commit all changes atomically
141
+ await batch.commit();
142
+
143
+ console.log("[freeConsultationInfrastructure] Successfully created:");
144
+ console.log(" ✓ Category: consultation");
145
+ console.log(" ✓ Subcategory: free-consultation");
146
+ console.log(" ✓ Technology: free-consultation-tech");
147
+ }
@@ -55,19 +55,29 @@ import { distanceBetween } from "geofire-common";
55
55
  import { CertificationSpecialty } from "../../backoffice/types/static/certification.types";
56
56
  import { Clinic, DoctorInfo, CLINICS_COLLECTION } from "../../types/clinic";
57
57
  import { ClinicInfo } from "../../types/profile";
58
+ import { ProcedureService } from "../procedure/procedure.service";
59
+ import { ProcedureFamily } from "../../backoffice/types/static/procedure-family.types";
60
+ import {
61
+ Currency,
62
+ PricingMeasure,
63
+ } from "../../backoffice/types/static/pricing.types";
64
+ import { CreateProcedureData } from "../../types/procedure";
58
65
 
59
66
  export class PractitionerService extends BaseService {
60
67
  private clinicService?: ClinicService;
61
68
  private mediaService: MediaService;
69
+ private procedureService?: ProcedureService;
62
70
 
63
71
  constructor(
64
72
  db: Firestore,
65
73
  auth: Auth,
66
74
  app: FirebaseApp,
67
- clinicService?: ClinicService
75
+ clinicService?: ClinicService,
76
+ procedureService?: ProcedureService
68
77
  ) {
69
78
  super(db, auth, app);
70
79
  this.clinicService = clinicService;
80
+ this.procedureService = procedureService;
71
81
  this.mediaService = new MediaService(db, auth, app);
72
82
  }
73
83
 
@@ -78,10 +88,21 @@ export class PractitionerService extends BaseService {
78
88
  return this.clinicService;
79
89
  }
80
90
 
91
+ private getProcedureService(): ProcedureService {
92
+ if (!this.procedureService) {
93
+ throw new Error("Procedure service not initialized!");
94
+ }
95
+ return this.procedureService;
96
+ }
97
+
81
98
  setClinicService(clinicService: ClinicService): void {
82
99
  this.clinicService = clinicService;
83
100
  }
84
101
 
102
+ setProcedureService(procedureService: ProcedureService): void {
103
+ this.procedureService = procedureService;
104
+ }
105
+
85
106
  /**
86
107
  * Handles profile photo upload for practitioners
87
108
  * @param profilePhoto - MediaResource (File, Blob, or URL string)
@@ -1183,4 +1204,160 @@ export class PractitionerService extends BaseService {
1183
1204
  throw error;
1184
1205
  }
1185
1206
  }
1207
+
1208
+ /**
1209
+ * Enables free consultation for a practitioner in a specific clinic
1210
+ * Creates a free consultation procedure with hardcoded parameters
1211
+ * @param practitionerId - ID of the practitioner
1212
+ * @param clinicId - ID of the clinic
1213
+ * @returns The created consultation procedure
1214
+ */
1215
+ async EnableFreeConsultation(
1216
+ practitionerId: string,
1217
+ clinicId: string
1218
+ ): Promise<void> {
1219
+ try {
1220
+ // Validate that practitioner exists and is active
1221
+ const practitioner = await this.getPractitioner(practitionerId);
1222
+ if (!practitioner) {
1223
+ throw new Error(`Practitioner ${practitionerId} not found`);
1224
+ }
1225
+
1226
+ if (
1227
+ !practitioner.isActive ||
1228
+ practitioner.status !== PractitionerStatus.ACTIVE
1229
+ ) {
1230
+ throw new Error(`Practitioner ${practitionerId} is not active`);
1231
+ }
1232
+
1233
+ // Validate that clinic exists
1234
+ const clinic = await this.getClinicService().getClinic(clinicId);
1235
+ if (!clinic) {
1236
+ throw new Error(`Clinic ${clinicId} not found`);
1237
+ }
1238
+
1239
+ // Check if practitioner is associated with this clinic
1240
+ if (!practitioner.clinics.includes(clinicId)) {
1241
+ throw new Error(
1242
+ `Practitioner ${practitionerId} is not associated with clinic ${clinicId}`
1243
+ );
1244
+ }
1245
+
1246
+ // Check if free consultation already exists for this practitioner in this clinic
1247
+ const existingProcedures =
1248
+ await this.getProcedureService().getProceduresByPractitioner(
1249
+ practitionerId
1250
+ );
1251
+ const existingConsultation = existingProcedures.find(
1252
+ (procedure) =>
1253
+ procedure.name === "Free Consultation" &&
1254
+ procedure.clinicBranchId === clinicId &&
1255
+ procedure.isActive
1256
+ );
1257
+
1258
+ if (existingConsultation) {
1259
+ console.log(
1260
+ `Free consultation already exists for practitioner ${practitionerId} in clinic ${clinicId}`
1261
+ );
1262
+ return;
1263
+ }
1264
+
1265
+ // Create procedure data for free consultation (without productId)
1266
+ const consultationData: Omit<CreateProcedureData, "productId"> = {
1267
+ name: "Free Consultation",
1268
+ description:
1269
+ "Free initial consultation to discuss treatment options and assess patient needs.",
1270
+ family: ProcedureFamily.AESTHETICS,
1271
+ categoryId: "consultation",
1272
+ subcategoryId: "free-consultation",
1273
+ technologyId: "free-consultation-tech",
1274
+ price: 0,
1275
+ currency: Currency.EUR,
1276
+ pricingMeasure: PricingMeasure.PER_SESSION,
1277
+ duration: 30, // 30 minutes consultation
1278
+ practitionerId: practitionerId,
1279
+ clinicBranchId: clinicId,
1280
+ photos: [], // No photos for consultation
1281
+ };
1282
+
1283
+ // Create the consultation procedure using the special method
1284
+ await this.getProcedureService().createConsultationProcedure(
1285
+ consultationData
1286
+ );
1287
+
1288
+ console.log(
1289
+ `Free consultation enabled for practitioner ${practitionerId} in clinic ${clinicId}`
1290
+ );
1291
+ } catch (error) {
1292
+ console.error(
1293
+ `Error enabling free consultation for practitioner ${practitionerId} in clinic ${clinicId}:`,
1294
+ error
1295
+ );
1296
+ throw error;
1297
+ }
1298
+ }
1299
+
1300
+ /**
1301
+ * Disables free consultation for a practitioner in a specific clinic
1302
+ * Finds and deactivates the existing free consultation procedure
1303
+ * @param practitionerId - ID of the practitioner
1304
+ * @param clinicId - ID of the clinic
1305
+ */
1306
+ async DisableFreeConsultation(
1307
+ practitionerId: string,
1308
+ clinicId: string
1309
+ ): Promise<void> {
1310
+ try {
1311
+ // Validate that practitioner exists
1312
+ const practitioner = await this.getPractitioner(practitionerId);
1313
+ if (!practitioner) {
1314
+ throw new Error(`Practitioner ${practitionerId} not found`);
1315
+ }
1316
+
1317
+ // Validate that clinic exists
1318
+ const clinic = await this.getClinicService().getClinic(clinicId);
1319
+ if (!clinic) {
1320
+ throw new Error(`Clinic ${clinicId} not found`);
1321
+ }
1322
+
1323
+ // Check if practitioner is associated with this clinic
1324
+ if (!practitioner.clinics.includes(clinicId)) {
1325
+ throw new Error(
1326
+ `Practitioner ${practitionerId} is not associated with clinic ${clinicId}`
1327
+ );
1328
+ }
1329
+
1330
+ // Find the free consultation procedure for this practitioner in this clinic
1331
+ const existingProcedures =
1332
+ await this.getProcedureService().getProceduresByPractitioner(
1333
+ practitionerId
1334
+ );
1335
+ const freeConsultation = existingProcedures.find(
1336
+ (procedure) =>
1337
+ procedure.name === "Free Consultation" &&
1338
+ procedure.clinicBranchId === clinicId &&
1339
+ procedure.isActive
1340
+ );
1341
+
1342
+ if (!freeConsultation) {
1343
+ console.log(
1344
+ `No active free consultation found for practitioner ${practitionerId} in clinic ${clinicId}`
1345
+ );
1346
+ return;
1347
+ }
1348
+
1349
+ // Deactivate the consultation procedure
1350
+ await this.getProcedureService().deactivateProcedure(freeConsultation.id);
1351
+
1352
+ console.log(
1353
+ `Free consultation disabled for practitioner ${practitionerId} in clinic ${clinicId}`
1354
+ );
1355
+ } catch (error) {
1356
+ console.error(
1357
+ `Error disabling free consultation for practitioner ${practitionerId} in clinic ${clinicId}:`,
1358
+ error
1359
+ );
1360
+ throw error;
1361
+ }
1362
+ }
1186
1363
  }