@blackcode_sa/metaestetics-api 1.7.26 → 1.7.28

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.7.26",
4
+ "version": "1.7.28",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -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
  }
package/src/index.ts CHANGED
@@ -31,6 +31,7 @@ export {
31
31
  FilledDocumentService,
32
32
  } from "./services/documentation-templates";
33
33
  export { CalendarServiceV2 } from "./services/calendar/calendar-refactored.service";
34
+ export { CalendarServiceV3 } from "./services/calendar/calendar.v3.service";
34
35
  export { SyncedCalendarsService } from "./services/calendar/synced-calendars.service";
35
36
  export { ReviewService } from "./services/reviews/reviews.service";
36
37
  export { AppointmentService } from "./services/appointment/appointment.service";
@@ -237,6 +238,8 @@ export type {
237
238
  SyncedCalendarEvent,
238
239
  CreateAppointmentParams,
239
240
  UpdateAppointmentParams,
241
+ CreateBlockingEventParams,
242
+ UpdateBlockingEventParams,
240
243
  } from "./types/calendar";
241
244
 
242
245
  export {
@@ -0,0 +1 @@
1
+ // Cloud functions recommender index file
@@ -0,0 +1,5 @@
1
+ // Here we will add cloud functions for recommender system
2
+
3
+ // Here we will do the calculation logic and cloud logic for all the recommendation calculations
4
+
5
+ // This is a main file, but I want it to use different calculations that will be placed in UTILS folder, not to contain all the logic for easier maintenance and readability
@@ -0,0 +1 @@
1
+ // Frontend recommender index file
@@ -0,0 +1,5 @@
1
+ // This service will be used for managing onboarding process for the patient, it will handle all data entry and retreive results
2
+
3
+ // This service will fill special fields and types that will be defined in types folder
4
+
5
+ // This service is not retreiving any recommendations in the UI and is only used by onboarding module (form and survey)
@@ -0,0 +1,3 @@
1
+ // This is a frontend UI implementation of recommender service, it will use cloud functions for calculations (HTTP callable), but it will wrap logic for getting results for the frontend
2
+
3
+ // This service should not be heavy, it should fetch recommendations, maybe even handle like/dislike for the results (for further refining if we implement that), but no more than that
@@ -0,0 +1 @@
1
+ // Recommender module re-exportindex file
@@ -0,0 +1,313 @@
1
+ import { Auth } from "firebase/auth";
2
+ import { Firestore, Timestamp, serverTimestamp } from "firebase/firestore";
3
+ import { FirebaseApp } from "firebase/app";
4
+ import { BaseService } from "../base.service";
5
+ import {
6
+ CalendarEvent,
7
+ CalendarEventStatus,
8
+ CalendarEventTime,
9
+ CalendarEventType,
10
+ CalendarSyncStatus,
11
+ CreateCalendarEventData,
12
+ UpdateCalendarEventData,
13
+ CALENDAR_COLLECTION,
14
+ SearchCalendarEventsParams,
15
+ SearchLocationEnum,
16
+ DateRange,
17
+ CreateBlockingEventParams,
18
+ UpdateBlockingEventParams,
19
+ } from "../../types/calendar";
20
+ import { PRACTITIONERS_COLLECTION } from "../../types/practitioner";
21
+ import { CLINICS_COLLECTION } from "../../types/clinic";
22
+ import { doc, getDoc, setDoc, updateDoc, deleteDoc } from "firebase/firestore";
23
+
24
+ // Import utility functions
25
+ import { searchCalendarEventsUtil } from "./utils/calendar-event.utils";
26
+
27
+ /**
28
+ * Calendar Service V3
29
+ * Focused on blocking event management and calendar event search
30
+ * Appointment logic is handled by AppointmentService and BookingAdmin
31
+ * External calendar sync is handled by dedicated cloud functions
32
+ */
33
+ export class CalendarServiceV3 extends BaseService {
34
+ /**
35
+ * Creates a new CalendarServiceV3 instance
36
+ * @param db - Firestore instance
37
+ * @param auth - Firebase Auth instance
38
+ * @param app - Firebase App instance
39
+ */
40
+ constructor(db: Firestore, auth: Auth, app: FirebaseApp) {
41
+ super(db, auth, app);
42
+ }
43
+
44
+ // #region Blocking Event CRUD Operations
45
+
46
+ /**
47
+ * Creates a blocking event for a practitioner or clinic
48
+ * @param params - Blocking event creation parameters
49
+ * @returns Created calendar event
50
+ */
51
+ async createBlockingEvent(
52
+ params: CreateBlockingEventParams
53
+ ): Promise<CalendarEvent> {
54
+ // Validate input parameters
55
+ this.validateBlockingEventParams(params);
56
+
57
+ // Generate a unique ID for the event
58
+ const eventId = this.generateId();
59
+
60
+ // Determine the collection path based on entity type
61
+ const collectionPath = this.getEntityCalendarPath(
62
+ params.entityType,
63
+ params.entityId
64
+ );
65
+
66
+ // Create the event document reference
67
+ const eventRef = doc(this.db, collectionPath, eventId);
68
+
69
+ // Prepare the event data
70
+ const eventData: CreateCalendarEventData = {
71
+ id: eventId,
72
+ eventName: params.eventName,
73
+ eventTime: params.eventTime,
74
+ eventType: params.eventType,
75
+ description: params.description || "",
76
+ status: CalendarEventStatus.CONFIRMED, // Blocking events are always confirmed
77
+ syncStatus: CalendarSyncStatus.INTERNAL,
78
+ createdAt: serverTimestamp(),
79
+ updatedAt: serverTimestamp(),
80
+ };
81
+
82
+ // Set entity-specific fields
83
+ if (params.entityType === "practitioner") {
84
+ eventData.practitionerProfileId = params.entityId;
85
+ } else {
86
+ eventData.clinicBranchId = params.entityId;
87
+ }
88
+
89
+ // Create the event
90
+ await setDoc(eventRef, eventData);
91
+
92
+ // Return the created event
93
+ return {
94
+ ...eventData,
95
+ createdAt: Timestamp.now(),
96
+ updatedAt: Timestamp.now(),
97
+ } as CalendarEvent;
98
+ }
99
+
100
+ /**
101
+ * Updates a blocking event
102
+ * @param params - Blocking event update parameters
103
+ * @returns Updated calendar event
104
+ */
105
+ async updateBlockingEvent(
106
+ params: UpdateBlockingEventParams
107
+ ): Promise<CalendarEvent> {
108
+ // Determine the collection path
109
+ const collectionPath = this.getEntityCalendarPath(
110
+ params.entityType,
111
+ params.entityId
112
+ );
113
+ const eventRef = doc(this.db, collectionPath, params.eventId);
114
+
115
+ // Check if event exists
116
+ const eventDoc = await getDoc(eventRef);
117
+ if (!eventDoc.exists()) {
118
+ throw new Error(`Blocking event with ID ${params.eventId} not found`);
119
+ }
120
+
121
+ // Prepare update data
122
+ const updateData: Partial<UpdateCalendarEventData> = {
123
+ updatedAt: serverTimestamp(),
124
+ };
125
+
126
+ if (params.eventName !== undefined) {
127
+ updateData.eventName = params.eventName;
128
+ }
129
+ if (params.eventTime !== undefined) {
130
+ updateData.eventTime = params.eventTime;
131
+ }
132
+ if (params.description !== undefined) {
133
+ updateData.description = params.description;
134
+ }
135
+ if (params.status !== undefined) {
136
+ updateData.status = params.status;
137
+ }
138
+
139
+ // Update the event
140
+ await updateDoc(eventRef, updateData);
141
+
142
+ // Get and return the updated event
143
+ const updatedEventDoc = await getDoc(eventRef);
144
+ return updatedEventDoc.data() as CalendarEvent;
145
+ }
146
+
147
+ /**
148
+ * Deletes a blocking event
149
+ * @param entityType - Type of entity (practitioner or clinic)
150
+ * @param entityId - ID of the entity
151
+ * @param eventId - ID of the event to delete
152
+ */
153
+ async deleteBlockingEvent(
154
+ entityType: "practitioner" | "clinic",
155
+ entityId: string,
156
+ eventId: string
157
+ ): Promise<void> {
158
+ // Determine the collection path
159
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
160
+ const eventRef = doc(this.db, collectionPath, eventId);
161
+
162
+ // Check if event exists
163
+ const eventDoc = await getDoc(eventRef);
164
+ if (!eventDoc.exists()) {
165
+ throw new Error(`Blocking event with ID ${eventId} not found`);
166
+ }
167
+
168
+ // Delete the event
169
+ await deleteDoc(eventRef);
170
+ }
171
+
172
+ /**
173
+ * Gets a specific blocking event
174
+ * @param entityType - Type of entity (practitioner or clinic)
175
+ * @param entityId - ID of the entity
176
+ * @param eventId - ID of the event to retrieve
177
+ * @returns Calendar event or null if not found
178
+ */
179
+ async getBlockingEvent(
180
+ entityType: "practitioner" | "clinic",
181
+ entityId: string,
182
+ eventId: string
183
+ ): Promise<CalendarEvent | null> {
184
+ // Determine the collection path
185
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
186
+ const eventRef = doc(this.db, collectionPath, eventId);
187
+
188
+ // Get the event
189
+ const eventDoc = await getDoc(eventRef);
190
+ if (!eventDoc.exists()) {
191
+ return null;
192
+ }
193
+
194
+ return eventDoc.data() as CalendarEvent;
195
+ }
196
+
197
+ /**
198
+ * Gets blocking events for a specific entity
199
+ * @param entityType - Type of entity (practitioner or clinic)
200
+ * @param entityId - ID of the entity
201
+ * @param dateRange - Optional date range filter
202
+ * @param eventType - Optional event type filter
203
+ * @returns Array of calendar events
204
+ */
205
+ async getEntityBlockingEvents(
206
+ entityType: "practitioner" | "clinic",
207
+ entityId: string,
208
+ dateRange?: DateRange,
209
+ eventType?: CalendarEventType
210
+ ): Promise<CalendarEvent[]> {
211
+ // Use the existing search functionality
212
+ const searchParams: SearchCalendarEventsParams = {
213
+ searchLocation:
214
+ entityType === "practitioner"
215
+ ? SearchLocationEnum.PRACTITIONER
216
+ : SearchLocationEnum.CLINIC,
217
+ entityId,
218
+ dateRange,
219
+ eventType,
220
+ };
221
+
222
+ // Filter to only blocking-type events if no specific eventType is provided
223
+ if (!eventType) {
224
+ // We'll need to filter the results to only include blocking-type events
225
+ const allEvents = await searchCalendarEventsUtil(this.db, searchParams);
226
+ return allEvents.filter(
227
+ (event) =>
228
+ event.eventType === CalendarEventType.BLOCKING ||
229
+ event.eventType === CalendarEventType.BREAK ||
230
+ event.eventType === CalendarEventType.FREE_DAY ||
231
+ event.eventType === CalendarEventType.OTHER
232
+ );
233
+ }
234
+
235
+ return searchCalendarEventsUtil(this.db, searchParams);
236
+ }
237
+
238
+ // #endregion
239
+
240
+ // #region Calendar Event Search
241
+
242
+ /**
243
+ * Searches for calendar events based on specified criteria.
244
+ * This method supports searching for ALL event types (appointments, blocking events, etc.)
245
+ *
246
+ * @param params - The search parameters
247
+ * @returns A promise that resolves to an array of matching calendar events
248
+ */
249
+ async searchCalendarEvents(
250
+ params: SearchCalendarEventsParams
251
+ ): Promise<CalendarEvent[]> {
252
+ // Use the utility function to perform the search
253
+ return searchCalendarEventsUtil(this.db, params);
254
+ }
255
+
256
+ // #endregion
257
+
258
+ // #region Private Helper Methods
259
+
260
+ /**
261
+ * Gets the calendar collection path for a specific entity
262
+ * @param entityType - Type of entity (practitioner or clinic)
263
+ * @param entityId - ID of the entity
264
+ * @returns Collection path string
265
+ */
266
+ private getEntityCalendarPath(
267
+ entityType: "practitioner" | "clinic",
268
+ entityId: string
269
+ ): string {
270
+ if (entityType === "practitioner") {
271
+ return `${PRACTITIONERS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
272
+ } else {
273
+ return `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Validates blocking event creation parameters
279
+ * @param params - Parameters to validate
280
+ * @throws Error if validation fails
281
+ */
282
+ private validateBlockingEventParams(params: CreateBlockingEventParams): void {
283
+ if (!params.entityType || !params.entityId) {
284
+ throw new Error("Entity type and ID are required");
285
+ }
286
+
287
+ if (!params.eventName || params.eventName.trim() === "") {
288
+ throw new Error("Event name is required");
289
+ }
290
+
291
+ if (!params.eventTime || !params.eventTime.start || !params.eventTime.end) {
292
+ throw new Error("Event time with start and end is required");
293
+ }
294
+
295
+ // Validate that end time is after start time
296
+ if (params.eventTime.end.toMillis() <= params.eventTime.start.toMillis()) {
297
+ throw new Error("Event end time must be after start time");
298
+ }
299
+
300
+ // Validate event type is one of the blocking types
301
+ const validTypes = [
302
+ CalendarEventType.BLOCKING,
303
+ CalendarEventType.BREAK,
304
+ CalendarEventType.FREE_DAY,
305
+ CalendarEventType.OTHER,
306
+ ];
307
+ if (!validTypes.includes(params.eventType)) {
308
+ throw new Error("Invalid event type for blocking events");
309
+ }
310
+ }
311
+
312
+ // #endregion
313
+ }