@blackcode_sa/metaestetics-api 1.14.54 → 1.14.57

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/index.mjs CHANGED
@@ -3404,7 +3404,9 @@ import {
3404
3404
  limit as limit3,
3405
3405
  startAfter as startAfter2,
3406
3406
  getDocs as getDocs6,
3407
- getCountFromServer
3407
+ getCountFromServer,
3408
+ doc as doc10,
3409
+ updateDoc as updateDoc8
3408
3410
  } from "firebase/firestore";
3409
3411
  import { getFunctions as getFunctions2 } from "firebase/functions";
3410
3412
 
@@ -3825,7 +3827,10 @@ var zoneItemDataSchema = z3.object({
3825
3827
  notes: z3.string().max(MAX_STRING_LENGTH_LONG, "Notes too long").optional(),
3826
3828
  notesVisibleToPatient: z3.boolean().optional().default(false),
3827
3829
  subtotal: z3.number().min(0, "Subtotal must be non-negative").optional(),
3828
- ionNumber: z3.string().optional(),
3830
+ ionNumber: z3.string().nullable().optional(),
3831
+ // Batch/Lot number - can be null to clear/delete
3832
+ expiryDate: z3.string().nullable().optional(),
3833
+ // ISO date string (YYYY-MM-DD) - can be null to clear/delete
3829
3834
  createdAt: z3.string().optional(),
3830
3835
  updatedAt: z3.string().optional()
3831
3836
  }).refine(
@@ -4786,6 +4791,7 @@ async function removeItemFromZoneUtil(db, appointmentId, zoneId, itemIndex) {
4786
4791
  return getAppointmentOrThrow(db, appointmentId);
4787
4792
  }
4788
4793
  async function updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, updates) {
4794
+ var _a, _b, _c, _d;
4789
4795
  validateZoneKeyFormat(zoneId);
4790
4796
  const appointment = await getAppointmentOrThrow(db, appointmentId);
4791
4797
  const metadata = initializeMetadata(appointment);
@@ -4796,17 +4802,37 @@ async function updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, updates)
4796
4802
  if (itemIndex < 0 || itemIndex >= items.length) {
4797
4803
  throw new Error(`Invalid item index ${itemIndex} for zone ${zoneId}`);
4798
4804
  }
4805
+ const cleanUpdates = Object.fromEntries(
4806
+ Object.entries(updates).filter(([_, value]) => value !== void 0).map(([key, value]) => [
4807
+ key,
4808
+ value === "" ? null : value
4809
+ // Convert empty strings to null
4810
+ ])
4811
+ );
4812
+ console.log(`[updateZoneItemUtil] Updates received:`, {
4813
+ itemIndex,
4814
+ zoneId,
4815
+ rawUpdates: updates,
4816
+ cleanUpdates,
4817
+ hasIonNumber: "ionNumber" in cleanUpdates,
4818
+ hasExpiryDate: "expiryDate" in cleanUpdates,
4819
+ ionNumberValue: cleanUpdates.ionNumber,
4820
+ expiryDateValue: cleanUpdates.expiryDate
4821
+ });
4799
4822
  items[itemIndex] = {
4800
4823
  ...items[itemIndex],
4801
- ...updates,
4824
+ ...cleanUpdates,
4802
4825
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
4803
4826
  };
4804
- console.log(`[updateZoneItemUtil] BEFORE recalculation:`, {
4827
+ console.log(`[updateZoneItemUtil] Item after update:`, {
4805
4828
  itemIndex,
4829
+ ionNumber: items[itemIndex].ionNumber,
4830
+ expiryDate: items[itemIndex].expiryDate,
4806
4831
  quantity: items[itemIndex].quantity,
4807
4832
  priceOverrideAmount: items[itemIndex].priceOverrideAmount,
4808
4833
  price: items[itemIndex].price,
4809
- oldSubtotal: items[itemIndex].subtotal
4834
+ oldSubtotal: items[itemIndex].subtotal,
4835
+ allItemKeys: Object.keys(items[itemIndex])
4810
4836
  });
4811
4837
  items[itemIndex].subtotal = calculateItemSubtotal(items[itemIndex]);
4812
4838
  console.log(`[updateZoneItemUtil] AFTER recalculation:`, {
@@ -4814,13 +4840,30 @@ async function updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, updates)
4814
4840
  newSubtotal: items[itemIndex].subtotal
4815
4841
  });
4816
4842
  const finalbilling = calculateFinalBilling(metadata.zonesData, 0.081);
4843
+ console.log(`[updateZoneItemUtil] Saving to Firestore:`, {
4844
+ appointmentId,
4845
+ zoneId,
4846
+ itemIndex,
4847
+ itemToSave: items[itemIndex],
4848
+ itemIonNumber: items[itemIndex].ionNumber,
4849
+ itemExpiryDate: items[itemIndex].expiryDate,
4850
+ zonesDataKeys: Object.keys(metadata.zonesData),
4851
+ zoneItemsCount: (_a = metadata.zonesData[zoneId]) == null ? void 0 : _a.length
4852
+ });
4817
4853
  const appointmentRef = doc5(db, APPOINTMENTS_COLLECTION, appointmentId);
4818
4854
  await updateDoc3(appointmentRef, {
4819
4855
  "metadata.zonesData": metadata.zonesData,
4820
4856
  "metadata.finalbilling": finalbilling,
4821
4857
  updatedAt: serverTimestamp2()
4822
4858
  });
4823
- return getAppointmentOrThrow(db, appointmentId);
4859
+ const savedAppointment = await getAppointmentOrThrow(db, appointmentId);
4860
+ const savedItem = (_d = (_c = (_b = savedAppointment.metadata) == null ? void 0 : _b.zonesData) == null ? void 0 : _c[zoneId]) == null ? void 0 : _d[itemIndex];
4861
+ console.log(`[updateZoneItemUtil] Verification after save:`, {
4862
+ savedItemIonNumber: savedItem == null ? void 0 : savedItem.ionNumber,
4863
+ savedItemExpiryDate: savedItem == null ? void 0 : savedItem.expiryDate,
4864
+ savedItemKeys: savedItem ? Object.keys(savedItem) : []
4865
+ });
4866
+ return savedAppointment;
4824
4867
  }
4825
4868
  async function overridePriceForZoneItemUtil(db, appointmentId, zoneId, itemIndex, newPrice) {
4826
4869
  return updateZoneItemUtil(db, appointmentId, zoneId, itemIndex, {
@@ -4950,7 +4993,9 @@ async function initializeFormsForExtendedProcedure(db, appointmentId, procedureI
4950
4993
  isRequired,
4951
4994
  sortingOrder: templateRef.sortingOrder,
4952
4995
  status: existingForm.status || "pending" /* PENDING */,
4953
- path: `${APPOINTMENTS_COLLECTION}/${appointmentId}/${formSubcollectionPath}/${existingForm.id}`
4996
+ path: `${APPOINTMENTS_COLLECTION}/${appointmentId}/${formSubcollectionPath}/${existingForm.id}`,
4997
+ procedureId
4998
+ // Track which procedure this form belongs to
4954
4999
  };
4955
5000
  initializedFormsInfo.push(linkedForm);
4956
5001
  if (!allLinkedFormIds.includes(existingForm.id)) {
@@ -5004,7 +5049,9 @@ async function initializeFormsForExtendedProcedure(db, appointmentId, procedureI
5004
5049
  isRequired,
5005
5050
  sortingOrder: templateRef.sortingOrder,
5006
5051
  status: "pending" /* PENDING */,
5007
- path: docRef.path
5052
+ path: docRef.path,
5053
+ procedureId
5054
+ // Track which procedure this form belongs to
5008
5055
  };
5009
5056
  initializedFormsInfo.push(linkedForm);
5010
5057
  const formType = isProcedureSpecific ? "procedure-specific" : "general/shared";
@@ -5196,6 +5243,8 @@ async function createExtendedProcedureInfo(db, procedureId) {
5196
5243
  return {
5197
5244
  procedureId,
5198
5245
  procedureName: data.name,
5246
+ procedureDescription: data.description || "",
5247
+ procedurePrice: data.price || 0,
5199
5248
  procedureFamily: data.family,
5200
5249
  // Use embedded family object
5201
5250
  procedureCategoryId: data.category.id,
@@ -5523,16 +5572,37 @@ async function getZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex) {
5523
5572
  return zoneArray[photoIndex];
5524
5573
  }
5525
5574
  async function updateZonePhotoVisibilityUtil(db, appointmentId, zoneId, photoIndex, showToPatient, doctorId) {
5575
+ const updates = { showToPatient };
5576
+ if (!showToPatient) {
5577
+ updates.beforeNoteVisibleToPatient = false;
5578
+ updates.afterNoteVisibleToPatient = false;
5579
+ }
5526
5580
  return updateZonePhotoEntryUtil(
5527
5581
  db,
5528
5582
  appointmentId,
5529
5583
  zoneId,
5530
5584
  photoIndex,
5531
- { showToPatient },
5585
+ updates,
5532
5586
  doctorId
5533
5587
  );
5534
5588
  }
5535
5589
  async function updateZonePhotoNoteVisibilityUtil(db, appointmentId, zoneId, photoIndex, noteType, visibleToPatient, doctorId) {
5590
+ var _a;
5591
+ const appointment = await getAppointmentOrThrow(db, appointmentId);
5592
+ const zonePhotos = (_a = appointment.metadata) == null ? void 0 : _a.zonePhotos;
5593
+ if (!zonePhotos || !zonePhotos[zoneId] || !Array.isArray(zonePhotos[zoneId])) {
5594
+ throw new Error(`No photos found for zone ${zoneId} in appointment ${appointmentId}`);
5595
+ }
5596
+ const zoneArray = zonePhotos[zoneId];
5597
+ if (photoIndex < 0 || photoIndex >= zoneArray.length) {
5598
+ throw new Error(`Invalid photo index ${photoIndex} for zone ${zoneId}. Must be between 0 and ${zoneArray.length - 1}`);
5599
+ }
5600
+ const photoEntry = zoneArray[photoIndex];
5601
+ if (visibleToPatient && !photoEntry.showToPatient) {
5602
+ throw new Error(
5603
+ 'Cannot make note visible to patient: The photo pair must be visible to the patient first. Please enable "Show to Patient" for the photo pair before making notes visible.'
5604
+ );
5605
+ }
5536
5606
  const updates = noteType === "before" ? { beforeNoteVisibleToPatient: visibleToPatient } : { afterNoteVisibleToPatient: visibleToPatient };
5537
5607
  return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, updates, doctorId);
5538
5608
  }
@@ -7176,6 +7246,8 @@ var AppointmentService = class extends BaseService {
7176
7246
  finalizationNotesInternal: currentMetadata.finalizationNotesInternal,
7177
7247
  finalizationNotes: currentMetadata.finalizationNotes
7178
7248
  });
7249
+ const normalizedSharedNotes = sharedNotes !== void 0 ? sharedNotes === "" || sharedNotes === null ? null : sharedNotes : currentMetadata.finalizationNotesShared;
7250
+ const normalizedInternalNotes = internalNotes !== void 0 ? internalNotes === "" || internalNotes === null ? null : internalNotes : currentMetadata.finalizationNotesInternal;
7179
7251
  const metadataUpdate = {
7180
7252
  selectedZones: currentMetadata.selectedZones,
7181
7253
  zonePhotos: currentMetadata.zonePhotos,
@@ -7184,21 +7256,38 @@ var AppointmentService = class extends BaseService {
7184
7256
  extendedProcedures: currentMetadata.extendedProcedures || [],
7185
7257
  recommendedProcedures: currentMetadata.recommendedProcedures || [],
7186
7258
  finalbilling: currentMetadata.finalbilling,
7187
- finalizationNotesShared: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotesShared,
7188
- finalizationNotesInternal: internalNotes !== void 0 ? internalNotes : currentMetadata.finalizationNotesInternal,
7259
+ finalizationNotesShared: normalizedSharedNotes,
7260
+ finalizationNotesInternal: normalizedInternalNotes,
7189
7261
  // Keep deprecated field for backward compatibility during migration
7190
- finalizationNotes: sharedNotes !== void 0 ? sharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
7262
+ finalizationNotes: normalizedSharedNotes !== null && normalizedSharedNotes !== void 0 ? normalizedSharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared
7191
7263
  };
7192
7264
  console.log("\u{1F50D} [APPOINTMENT_SERVICE] Update data metadata:", {
7193
7265
  finalizationNotesShared: metadataUpdate.finalizationNotesShared,
7194
7266
  finalizationNotesInternal: metadataUpdate.finalizationNotesInternal,
7195
- finalizationNotes: metadataUpdate.finalizationNotes
7267
+ finalizationNotes: metadataUpdate.finalizationNotes,
7268
+ normalizedSharedNotes,
7269
+ normalizedInternalNotes
7196
7270
  });
7197
- const updateData = {
7198
- metadata: metadataUpdate,
7271
+ const appointmentRef = doc10(this.db, APPOINTMENTS_COLLECTION, appointmentId);
7272
+ const updateFields = {
7273
+ "metadata.finalizationNotesShared": normalizedSharedNotes,
7274
+ "metadata.finalizationNotesInternal": normalizedInternalNotes,
7275
+ "metadata.finalizationNotes": normalizedSharedNotes !== null && normalizedSharedNotes !== void 0 ? normalizedSharedNotes : currentMetadata.finalizationNotes || currentMetadata.finalizationNotesShared,
7199
7276
  updatedAt: serverTimestamp7()
7200
7277
  };
7201
- const result = await this.updateAppointment(appointmentId, updateData);
7278
+ console.log("\u{1F50D} [APPOINTMENT_SERVICE] Direct Firestore update with dot notation:", {
7279
+ appointmentId,
7280
+ updateFields: {
7281
+ "metadata.finalizationNotesShared": updateFields["metadata.finalizationNotesShared"],
7282
+ "metadata.finalizationNotesInternal": updateFields["metadata.finalizationNotesInternal"],
7283
+ "metadata.finalizationNotes": updateFields["metadata.finalizationNotes"]
7284
+ }
7285
+ });
7286
+ await updateDoc8(appointmentRef, updateFields);
7287
+ const result = await this.getAppointmentById(appointmentId);
7288
+ if (!result) {
7289
+ throw new Error(`Failed to retrieve updated appointment ${appointmentId}`);
7290
+ }
7202
7291
  console.log("\u{1F50D} [APPOINTMENT_SERVICE] After update, result metadata:", {
7203
7292
  finalizationNotesShared: (_a = result.metadata) == null ? void 0 : _a.finalizationNotesShared,
7204
7293
  finalizationNotesInternal: (_b = result.metadata) == null ? void 0 : _b.finalizationNotesInternal,
@@ -7949,7 +8038,7 @@ import {
7949
8038
  getDocs as getDocs14,
7950
8039
  query as query14,
7951
8040
  where as where14,
7952
- updateDoc as updateDoc18,
8041
+ updateDoc as updateDoc19,
7953
8042
  deleteDoc as deleteDoc5,
7954
8043
  Timestamp as Timestamp19,
7955
8044
  setDoc as setDoc12,
@@ -8056,7 +8145,7 @@ import {
8056
8145
  doc as doc19,
8057
8146
  getDoc as getDoc21,
8058
8147
  writeBatch,
8059
- updateDoc as updateDoc16,
8148
+ updateDoc as updateDoc17,
8060
8149
  serverTimestamp as serverTimestamp16
8061
8150
  } from "firebase/firestore";
8062
8151
  import { Timestamp as Timestamp16 } from "firebase/firestore";
@@ -8084,7 +8173,7 @@ import {
8084
8173
  } from "firebase/firestore";
8085
8174
 
8086
8175
  // src/services/patient/utils/sensitive.utils.ts
8087
- import { getDoc as getDoc12, updateDoc as updateDoc9, setDoc as setDoc4, serverTimestamp as serverTimestamp9 } from "firebase/firestore";
8176
+ import { getDoc as getDoc12, updateDoc as updateDoc10, setDoc as setDoc4, serverTimestamp as serverTimestamp9 } from "firebase/firestore";
8088
8177
 
8089
8178
  // src/validations/patient.schema.ts
8090
8179
  import { z as z7 } from "zod";
@@ -8554,7 +8643,7 @@ import {
8554
8643
  getDocs as getDocs8,
8555
8644
  query as query8,
8556
8645
  where as where8,
8557
- updateDoc as updateDoc8,
8646
+ updateDoc as updateDoc9,
8558
8647
  setDoc as setDoc3,
8559
8648
  deleteDoc as deleteDoc3,
8560
8649
  Timestamp as Timestamp11,
@@ -9289,7 +9378,7 @@ async function updateClinicAdmin(db, adminId, data) {
9289
9378
  ...data,
9290
9379
  updatedAt: serverTimestamp8()
9291
9380
  };
9292
- await updateDoc8(doc12(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
9381
+ await updateDoc9(doc12(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
9293
9382
  const updatedAdmin = await getClinicAdmin(db, adminId);
9294
9383
  if (!updatedAdmin) {
9295
9384
  throw new Error("Failed to retrieve updated admin");
@@ -9531,7 +9620,7 @@ var updateSensitiveInfoUtil = async (db, patientId, data, requesterId, requester
9531
9620
  photoUrl: processedPhotoUrl,
9532
9621
  updatedAt: serverTimestamp9()
9533
9622
  };
9534
- await updateDoc9(getSensitiveInfoDocRef(db, patientId), updateData);
9623
+ await updateDoc10(getSensitiveInfoDocRef(db, patientId), updateData);
9535
9624
  const updatedDoc = await getDoc12(getSensitiveInfoDocRef(db, patientId));
9536
9625
  if (!updatedDoc.exists()) {
9537
9626
  throw new Error("Failed to retrieve updated sensitive information");
@@ -9558,7 +9647,7 @@ var claimPatientSensitiveInfoUtil = async (db, patientId, userId) => {
9558
9647
  if (sensitiveData.userRef) {
9559
9648
  throw new Error("Patient sensitive information has already been claimed");
9560
9649
  }
9561
- await updateDoc9(getSensitiveInfoDocRef(db, patientId), {
9650
+ await updateDoc10(getSensitiveInfoDocRef(db, patientId), {
9562
9651
  userRef: userId,
9563
9652
  updatedAt: serverTimestamp9()
9564
9653
  });
@@ -9756,7 +9845,7 @@ var getPatientsByClinicWithDetailsUtil = async (db, clinicId, options) => {
9756
9845
  // src/services/patient/utils/location.utils.ts
9757
9846
  import {
9758
9847
  getDoc as getDoc15,
9759
- updateDoc as updateDoc10,
9848
+ updateDoc as updateDoc11,
9760
9849
  setDoc as setDoc6,
9761
9850
  serverTimestamp as serverTimestamp11
9762
9851
  } from "firebase/firestore";
@@ -9772,7 +9861,7 @@ var updatePatientLocationUtil = async (db, patientId, latitude, longitude) => {
9772
9861
  locationData,
9773
9862
  updatedAt: serverTimestamp11()
9774
9863
  };
9775
- await updateDoc10(getLocationInfoDocRef(db, patientId), updateData);
9864
+ await updateDoc11(getLocationInfoDocRef(db, patientId), updateData);
9776
9865
  };
9777
9866
  var createLocationInfoUtil = async (db, data, requesterId) => {
9778
9867
  try {
@@ -9827,7 +9916,7 @@ var updateLocationInfoUtil = async (db, patientId, data, requesterId) => {
9827
9916
  };
9828
9917
  }
9829
9918
  updateData.updatedAt = serverTimestamp11();
9830
- await updateDoc10(getLocationInfoDocRef(db, patientId), updateData);
9919
+ await updateDoc11(getLocationInfoDocRef(db, patientId), updateData);
9831
9920
  const updatedInfo = await getLocationInfoUtil(db, patientId, requesterId);
9832
9921
  if (!updatedInfo) {
9833
9922
  throw new Error("Failed to retrieve updated location information");
@@ -9838,7 +9927,7 @@ var updateLocationInfoUtil = async (db, patientId, data, requesterId) => {
9838
9927
  // src/services/patient/utils/medical-stuff.utils.ts
9839
9928
  import {
9840
9929
  getDoc as getDoc16,
9841
- updateDoc as updateDoc11,
9930
+ updateDoc as updateDoc12,
9842
9931
  arrayUnion as arrayUnion2,
9843
9932
  arrayRemove as arrayRemove2,
9844
9933
  serverTimestamp as serverTimestamp12,
@@ -9874,7 +9963,7 @@ var addDoctorUtil = async (db, patientId, doctorRef, assignedBy) => {
9874
9963
  } else {
9875
9964
  updates.doctors = arrayUnion2(newDoctor);
9876
9965
  }
9877
- await updateDoc11(getPatientDocRef(db, patientId), updates);
9966
+ await updateDoc12(getPatientDocRef(db, patientId), updates);
9878
9967
  };
9879
9968
  var removeDoctorUtil = async (db, patientId, doctorRef) => {
9880
9969
  var _a;
@@ -9883,7 +9972,7 @@ var removeDoctorUtil = async (db, patientId, doctorRef) => {
9883
9972
  if (!patientDoc.exists()) throw new Error("Patient profile not found");
9884
9973
  const patientData = patientDoc.data();
9885
9974
  const updatedDoctors = ((_a = patientData.doctors) == null ? void 0 : _a.filter((doctor) => doctor.userRef !== doctorRef)) || [];
9886
- await updateDoc11(patientDocRef, {
9975
+ await updateDoc12(patientDocRef, {
9887
9976
  doctors: updatedDoctors,
9888
9977
  // Set the filtered array
9889
9978
  doctorIds: arrayRemove2(doctorRef),
@@ -9921,7 +10010,7 @@ var addClinicUtil = async (db, patientId, clinicId, assignedBy) => {
9921
10010
  } else {
9922
10011
  updates.clinics = arrayUnion2(newClinic);
9923
10012
  }
9924
- await updateDoc11(getPatientDocRef(db, patientId), updates);
10013
+ await updateDoc12(getPatientDocRef(db, patientId), updates);
9925
10014
  };
9926
10015
  var removeClinicUtil = async (db, patientId, clinicId) => {
9927
10016
  var _a;
@@ -9930,7 +10019,7 @@ var removeClinicUtil = async (db, patientId, clinicId) => {
9930
10019
  if (!patientDoc.exists()) throw new Error("Patient profile not found");
9931
10020
  const patientData = patientDoc.data();
9932
10021
  const updatedClinics = ((_a = patientData.clinics) == null ? void 0 : _a.filter((clinic) => clinic.clinicId !== clinicId)) || [];
9933
- await updateDoc11(patientDocRef, {
10022
+ await updateDoc12(patientDocRef, {
9934
10023
  clinics: updatedClinics,
9935
10024
  // Set the filtered array
9936
10025
  clinicIds: arrayRemove2(clinicId),
@@ -9942,7 +10031,7 @@ var removeClinicUtil = async (db, patientId, clinicId) => {
9942
10031
  // src/services/patient/utils/medical.utils.ts
9943
10032
  import {
9944
10033
  getDoc as getDoc17,
9945
- updateDoc as updateDoc12,
10034
+ updateDoc as updateDoc13,
9946
10035
  setDoc as setDoc7,
9947
10036
  serverTimestamp as serverTimestamp13,
9948
10037
  arrayUnion as arrayUnion3
@@ -10025,7 +10114,7 @@ var updateVitalStatsUtil = async (db, patientId, data, requesterId, requesterRol
10025
10114
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
10026
10115
  await ensureMedicalInfoExists(db, patientId, requesterId);
10027
10116
  const validatedData = updateVitalStatsSchema.parse(data);
10028
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10117
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10029
10118
  vitalStats: validatedData,
10030
10119
  lastUpdated: serverTimestamp13(),
10031
10120
  updatedBy: requesterId
@@ -10035,7 +10124,7 @@ var addAllergyUtil = async (db, patientId, data, requesterId, requesterRoles) =>
10035
10124
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
10036
10125
  await ensureMedicalInfoExists(db, patientId, requesterId);
10037
10126
  const validatedData = addAllergySchema.parse(data);
10038
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10127
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10039
10128
  allergies: arrayUnion3(validatedData),
10040
10129
  lastUpdated: serverTimestamp13(),
10041
10130
  updatedBy: requesterId
@@ -10056,7 +10145,7 @@ var updateAllergyUtil = async (db, patientId, data, requesterId, requesterRoles)
10056
10145
  ...updatedAllergies[allergyIndex],
10057
10146
  ...updateData
10058
10147
  };
10059
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10148
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10060
10149
  allergies: updatedAllergies,
10061
10150
  lastUpdated: serverTimestamp13(),
10062
10151
  updatedBy: requesterId
@@ -10073,7 +10162,7 @@ var removeAllergyUtil = async (db, patientId, allergyIndex, requesterId, request
10073
10162
  const updatedAllergies = medicalInfo.allergies.filter(
10074
10163
  (_, index) => index !== allergyIndex
10075
10164
  );
10076
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10165
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10077
10166
  allergies: updatedAllergies,
10078
10167
  lastUpdated: serverTimestamp13(),
10079
10168
  updatedBy: requesterId
@@ -10083,7 +10172,7 @@ var addBlockingConditionUtil = async (db, patientId, data, requesterId, requeste
10083
10172
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
10084
10173
  await ensureMedicalInfoExists(db, patientId, requesterId);
10085
10174
  const validatedData = addBlockingConditionSchema.parse(data);
10086
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10175
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10087
10176
  blockingConditions: arrayUnion3(validatedData),
10088
10177
  lastUpdated: serverTimestamp13(),
10089
10178
  updatedBy: requesterId
@@ -10104,7 +10193,7 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
10104
10193
  ...updatedConditions[conditionIndex],
10105
10194
  ...updateData
10106
10195
  };
10107
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10196
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10108
10197
  blockingConditions: updatedConditions,
10109
10198
  lastUpdated: serverTimestamp13(),
10110
10199
  updatedBy: requesterId
@@ -10121,7 +10210,7 @@ var removeBlockingConditionUtil = async (db, patientId, conditionIndex, requeste
10121
10210
  const updatedConditions = medicalInfo.blockingConditions.filter(
10122
10211
  (_, index) => index !== conditionIndex
10123
10212
  );
10124
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10213
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10125
10214
  blockingConditions: updatedConditions,
10126
10215
  lastUpdated: serverTimestamp13(),
10127
10216
  updatedBy: requesterId
@@ -10131,7 +10220,7 @@ var addContraindicationUtil = async (db, patientId, data, requesterId, requester
10131
10220
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
10132
10221
  await ensureMedicalInfoExists(db, patientId, requesterId);
10133
10222
  const validatedData = addContraindicationSchema.parse(data);
10134
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10223
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10135
10224
  contraindications: arrayUnion3(validatedData),
10136
10225
  lastUpdated: serverTimestamp13(),
10137
10226
  updatedBy: requesterId
@@ -10152,7 +10241,7 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
10152
10241
  ...updatedContraindications[contraindicationIndex],
10153
10242
  ...updateData
10154
10243
  };
10155
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10244
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10156
10245
  contraindications: updatedContraindications,
10157
10246
  lastUpdated: serverTimestamp13(),
10158
10247
  updatedBy: requesterId
@@ -10169,7 +10258,7 @@ var removeContraindicationUtil = async (db, patientId, contraindicationIndex, re
10169
10258
  const updatedContraindications = medicalInfo.contraindications.filter(
10170
10259
  (_, index) => index !== contraindicationIndex
10171
10260
  );
10172
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10261
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10173
10262
  contraindications: updatedContraindications,
10174
10263
  lastUpdated: serverTimestamp13(),
10175
10264
  updatedBy: requesterId
@@ -10179,7 +10268,7 @@ var addMedicationUtil = async (db, patientId, data, requesterId, requesterRoles)
10179
10268
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
10180
10269
  await ensureMedicalInfoExists(db, patientId, requesterId);
10181
10270
  const validatedData = addMedicationSchema.parse(data);
10182
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10271
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10183
10272
  currentMedications: arrayUnion3(validatedData),
10184
10273
  lastUpdated: serverTimestamp13(),
10185
10274
  updatedBy: requesterId
@@ -10200,7 +10289,7 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
10200
10289
  ...updatedMedications[medicationIndex],
10201
10290
  ...updateData
10202
10291
  };
10203
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10292
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10204
10293
  currentMedications: updatedMedications,
10205
10294
  lastUpdated: serverTimestamp13(),
10206
10295
  updatedBy: requesterId
@@ -10217,7 +10306,7 @@ var removeMedicationUtil = async (db, patientId, medicationIndex, requesterId, r
10217
10306
  const updatedMedications = medicalInfo.currentMedications.filter(
10218
10307
  (_, index) => index !== medicationIndex
10219
10308
  );
10220
- await updateDoc12(getMedicalInfoDocRef(db, patientId), {
10309
+ await updateDoc13(getMedicalInfoDocRef(db, patientId), {
10221
10310
  currentMedications: updatedMedications,
10222
10311
  lastUpdated: serverTimestamp13(),
10223
10312
  updatedBy: requesterId
@@ -10228,7 +10317,7 @@ var removeMedicationUtil = async (db, patientId, medicationIndex, requesterId, r
10228
10317
  import {
10229
10318
  getDoc as getDoc18,
10230
10319
  setDoc as setDoc8,
10231
- updateDoc as updateDoc13,
10320
+ updateDoc as updateDoc14,
10232
10321
  arrayUnion as arrayUnion4,
10233
10322
  arrayRemove as arrayRemove4,
10234
10323
  serverTimestamp as serverTimestamp14,
@@ -10365,19 +10454,19 @@ var getPatientProfileByUserRefUtil = async (db, userRef) => {
10365
10454
  }
10366
10455
  };
10367
10456
  var addExpoTokenUtil = async (db, patientId, token) => {
10368
- await updateDoc13(getPatientDocRef(db, patientId), {
10457
+ await updateDoc14(getPatientDocRef(db, patientId), {
10369
10458
  expoTokens: arrayUnion4(token),
10370
10459
  updatedAt: serverTimestamp14()
10371
10460
  });
10372
10461
  };
10373
10462
  var removeExpoTokenUtil = async (db, patientId, token) => {
10374
- await updateDoc13(getPatientDocRef(db, patientId), {
10463
+ await updateDoc14(getPatientDocRef(db, patientId), {
10375
10464
  expoTokens: arrayRemove4(token),
10376
10465
  updatedAt: serverTimestamp14()
10377
10466
  });
10378
10467
  };
10379
10468
  var addPointsUtil = async (db, patientId, points) => {
10380
- await updateDoc13(getPatientDocRef(db, patientId), {
10469
+ await updateDoc14(getPatientDocRef(db, patientId), {
10381
10470
  "gamification.points": increment(points),
10382
10471
  updatedAt: serverTimestamp14()
10383
10472
  });
@@ -10388,7 +10477,7 @@ var updatePatientProfileUtil = async (db, patientId, data) => {
10388
10477
  ...data,
10389
10478
  updatedAt: serverTimestamp14()
10390
10479
  };
10391
- await updateDoc13(getPatientDocRef(db, patientId), updateData);
10480
+ await updateDoc14(getPatientDocRef(db, patientId), updateData);
10392
10481
  const updatedDoc = await getDoc18(getPatientDocRef(db, patientId));
10393
10482
  if (!updatedDoc.exists()) {
10394
10483
  throw new Error("Patient profile not found after update");
@@ -10567,7 +10656,7 @@ import {
10567
10656
  query as query12,
10568
10657
  where as where12,
10569
10658
  setDoc as setDoc9,
10570
- updateDoc as updateDoc14,
10659
+ updateDoc as updateDoc15,
10571
10660
  Timestamp as Timestamp15,
10572
10661
  collectionGroup
10573
10662
  } from "firebase/firestore";
@@ -10662,7 +10751,7 @@ var markPatientTokenAsUsedUtil = async (db, tokenId, patientId, userId) => {
10662
10751
  INVITE_TOKENS_COLLECTION,
10663
10752
  tokenId
10664
10753
  );
10665
- await updateDoc14(tokenRef, {
10754
+ await updateDoc15(tokenRef, {
10666
10755
  status: "used" /* USED */,
10667
10756
  usedBy: userId,
10668
10757
  usedAt: Timestamp15.now()
@@ -10701,7 +10790,7 @@ var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
10701
10790
  };
10702
10791
 
10703
10792
  // src/services/patient/utils/aesthetic-analysis.utils.ts
10704
- import { getDoc as getDoc20, updateDoc as updateDoc15, setDoc as setDoc10, serverTimestamp as serverTimestamp15, doc as doc18 } from "firebase/firestore";
10793
+ import { getDoc as getDoc20, updateDoc as updateDoc16, setDoc as setDoc10, serverTimestamp as serverTimestamp15, doc as doc18 } from "firebase/firestore";
10705
10794
 
10706
10795
  // src/validations/patient/aesthetic-analysis.schema.ts
10707
10796
  import { z as z15 } from "zod";
@@ -10856,7 +10945,7 @@ var createOrUpdateAestheticAnalysisUtil = async (db, patientId, data, requesterI
10856
10945
  updatedAt: serverTimestamp15()
10857
10946
  });
10858
10947
  } else {
10859
- await updateDoc15(docRef, {
10948
+ await updateDoc16(docRef, {
10860
10949
  ...validatedData,
10861
10950
  completionPercentage,
10862
10951
  status,
@@ -11202,7 +11291,7 @@ var PatientService = class extends BaseService {
11202
11291
  "patient_profile_photos",
11203
11292
  file instanceof File ? file.name : `profile_photo_${patientId}`
11204
11293
  );
11205
- await updateDoc16(getSensitiveInfoDocRef(this.db, patientId), {
11294
+ await updateDoc17(getSensitiveInfoDocRef(this.db, patientId), {
11206
11295
  photoUrl: mediaMetadata.url,
11207
11296
  updatedAt: serverTimestamp16()
11208
11297
  });
@@ -11257,7 +11346,7 @@ var PatientService = class extends BaseService {
11257
11346
  error
11258
11347
  );
11259
11348
  }
11260
- await updateDoc16(getSensitiveInfoDocRef(this.db, patientId), {
11349
+ await updateDoc17(getSensitiveInfoDocRef(this.db, patientId), {
11261
11350
  photoUrl: null,
11262
11351
  updatedAt: serverTimestamp16()
11263
11352
  });
@@ -11584,7 +11673,7 @@ import {
11584
11673
  getDocs as getDocs13,
11585
11674
  query as query13,
11586
11675
  where as where13,
11587
- updateDoc as updateDoc17,
11676
+ updateDoc as updateDoc18,
11588
11677
  setDoc as setDoc11,
11589
11678
  deleteDoc as deleteDoc4,
11590
11679
  Timestamp as Timestamp18,
@@ -12176,7 +12265,7 @@ var PractitionerService = class extends BaseService {
12176
12265
  this.db,
12177
12266
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${tokenId}`
12178
12267
  );
12179
- await updateDoc17(tokenRef, {
12268
+ await updateDoc18(tokenRef, {
12180
12269
  status: "used" /* USED */,
12181
12270
  usedBy: userId,
12182
12271
  usedAt: Timestamp18.now()
@@ -12205,7 +12294,7 @@ var PractitionerService = class extends BaseService {
12205
12294
  if (tokenData.status !== "active" /* ACTIVE */) {
12206
12295
  throw new Error("Token is not active and cannot be revoked");
12207
12296
  }
12208
- await updateDoc17(tokenRef, {
12297
+ await updateDoc18(tokenRef, {
12209
12298
  status: "revoked" /* REVOKED */,
12210
12299
  updatedAt: serverTimestamp17()
12211
12300
  });
@@ -12603,7 +12692,7 @@ var PractitionerService = class extends BaseService {
12603
12692
  ...processedData,
12604
12693
  updatedAt: serverTimestamp17()
12605
12694
  };
12606
- await updateDoc17(practitionerRef, updateData);
12695
+ await updateDoc18(practitionerRef, updateData);
12607
12696
  const updatedPractitioner = await this.getPractitioner(practitionerId);
12608
12697
  if (!updatedPractitioner) {
12609
12698
  throw new Error(
@@ -12641,7 +12730,7 @@ var PractitionerService = class extends BaseService {
12641
12730
  );
12642
12731
  return;
12643
12732
  }
12644
- await updateDoc17(practitionerRef, {
12733
+ await updateDoc18(practitionerRef, {
12645
12734
  clinics: arrayUnion6(clinicId),
12646
12735
  updatedAt: serverTimestamp17()
12647
12736
  });
@@ -12667,7 +12756,7 @@ var PractitionerService = class extends BaseService {
12667
12756
  if (!practitionerDoc.exists()) {
12668
12757
  throw new Error(`Practitioner ${practitionerId} not found`);
12669
12758
  }
12670
- await updateDoc17(practitionerRef, {
12759
+ await updateDoc18(practitionerRef, {
12671
12760
  clinics: arrayRemove5(clinicId),
12672
12761
  updatedAt: serverTimestamp17()
12673
12762
  });
@@ -13484,7 +13573,7 @@ var UserService = class extends BaseService {
13484
13573
  return this.getUserById(userData.uid);
13485
13574
  }
13486
13575
  const profiles = await this.createProfilesForRoles(userData.uid, roles, options);
13487
- await updateDoc18(doc21(this.db, USERS_COLLECTION, userData.uid), profiles);
13576
+ await updateDoc19(doc21(this.db, USERS_COLLECTION, userData.uid), profiles);
13488
13577
  return this.getUserById(userData.uid);
13489
13578
  }
13490
13579
  /**
@@ -13651,7 +13740,7 @@ var UserService = class extends BaseService {
13651
13740
  if (!userDoc.exists()) {
13652
13741
  throw AUTH_ERRORS.USER_NOT_FOUND;
13653
13742
  }
13654
- await updateDoc18(userRef, {
13743
+ await updateDoc19(userRef, {
13655
13744
  lastLoginAt: serverTimestamp18(),
13656
13745
  updatedAt: serverTimestamp18()
13657
13746
  });
@@ -13663,7 +13752,7 @@ var UserService = class extends BaseService {
13663
13752
  if (!userDoc.exists()) {
13664
13753
  throw USER_ERRORS.NOT_FOUND;
13665
13754
  }
13666
- await updateDoc18(userRef, {
13755
+ await updateDoc19(userRef, {
13667
13756
  email,
13668
13757
  isAnonymous: false,
13669
13758
  updatedAt: serverTimestamp18()
@@ -13684,7 +13773,7 @@ var UserService = class extends BaseService {
13684
13773
  updatedAt: serverTimestamp18()
13685
13774
  };
13686
13775
  userSchema.parse(updatedUser);
13687
- await updateDoc18(userRef, {
13776
+ await updateDoc19(userRef, {
13688
13777
  ...updates,
13689
13778
  updatedAt: serverTimestamp18()
13690
13779
  });
@@ -13703,7 +13792,7 @@ var UserService = class extends BaseService {
13703
13792
  const user = await this.getUserById(uid);
13704
13793
  if (user.roles.includes(role)) return;
13705
13794
  const profiles = await this.createProfilesForRoles(uid, [role], options);
13706
- await updateDoc18(doc21(this.db, USERS_COLLECTION, uid), {
13795
+ await updateDoc19(doc21(this.db, USERS_COLLECTION, uid), {
13707
13796
  roles: [...user.roles, role],
13708
13797
  ...profiles,
13709
13798
  updatedAt: serverTimestamp18()
@@ -13732,7 +13821,7 @@ var UserService = class extends BaseService {
13732
13821
  }
13733
13822
  break;
13734
13823
  }
13735
- await updateDoc18(doc21(this.db, USERS_COLLECTION, uid), {
13824
+ await updateDoc19(doc21(this.db, USERS_COLLECTION, uid), {
13736
13825
  roles: user.roles.filter((r) => r !== role),
13737
13826
  updatedAt: serverTimestamp18()
13738
13827
  });
@@ -13758,7 +13847,7 @@ var UserService = class extends BaseService {
13758
13847
  } else {
13759
13848
  updateData.acquisitionSourceOther = null;
13760
13849
  }
13761
- await updateDoc18(userRef, updateData);
13850
+ await updateDoc19(userRef, updateData);
13762
13851
  }
13763
13852
  // Delete operations
13764
13853
  async deleteUser(uid) {
@@ -13936,7 +14025,7 @@ import {
13936
14025
  getDocs as getDocs16,
13937
14026
  query as query16,
13938
14027
  where as where16,
13939
- updateDoc as updateDoc19,
14028
+ updateDoc as updateDoc20,
13940
14029
  setDoc as setDoc13,
13941
14030
  Timestamp as Timestamp20
13942
14031
  } from "firebase/firestore";
@@ -14204,7 +14293,7 @@ async function updateClinicGroup(db, groupId, data, app) {
14204
14293
  updatedAt: Timestamp20.now()
14205
14294
  };
14206
14295
  console.log("[CLINIC_GROUP] Updating clinic group in Firestore");
14207
- await updateDoc19(doc22(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
14296
+ await updateDoc20(doc22(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
14208
14297
  console.log("[CLINIC_GROUP] Clinic group updated successfully");
14209
14298
  const updatedGroup = await getClinicGroup(db, groupId);
14210
14299
  if (!updatedGroup) {
@@ -14589,7 +14678,7 @@ import {
14589
14678
  doc as doc24,
14590
14679
  getDoc as getDoc26,
14591
14680
  getDocs as getDocs20,
14592
- updateDoc as updateDoc21,
14681
+ updateDoc as updateDoc22,
14593
14682
  serverTimestamp as serverTimestamp20,
14594
14683
  writeBatch as writeBatch4,
14595
14684
  arrayUnion as arrayUnion7
@@ -14609,7 +14698,7 @@ import {
14609
14698
  getDocs as getDocs17,
14610
14699
  query as query17,
14611
14700
  where as where17,
14612
- updateDoc as updateDoc20,
14701
+ updateDoc as updateDoc21,
14613
14702
  setDoc as setDoc14,
14614
14703
  Timestamp as Timestamp21,
14615
14704
  limit as limit9,
@@ -14826,7 +14915,7 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
14826
14915
  };
14827
14916
  console.log("[CLINIC] Updating clinic in Firestore");
14828
14917
  try {
14829
- await updateDoc20(doc23(db, CLINICS_COLLECTION, clinicId), updatedData);
14918
+ await updateDoc21(doc23(db, CLINICS_COLLECTION, clinicId), updatedData);
14830
14919
  console.log("[CLINIC] Clinic updated successfully");
14831
14920
  } catch (updateError) {
14832
14921
  console.error("[CLINIC] Error updating clinic in Firestore:", updateError);
@@ -15681,7 +15770,7 @@ var ClinicService = class extends BaseService {
15681
15770
  };
15682
15771
  }
15683
15772
  updatePayload.updatedAt = serverTimestamp20();
15684
- await updateDoc21(clinicRef, updatePayload);
15773
+ await updateDoc22(clinicRef, updatePayload);
15685
15774
  console.log(`[ClinicService] Clinic ${clinicId} updated successfully`);
15686
15775
  const updatedClinic = await this.getClinic(clinicId);
15687
15776
  if (!updatedClinic) throw new Error("Failed to retrieve updated clinic");
@@ -15699,7 +15788,7 @@ var ClinicService = class extends BaseService {
15699
15788
  */
15700
15789
  async deactivateClinic(clinicId, adminId) {
15701
15790
  const clinicRef = doc24(this.db, CLINICS_COLLECTION, clinicId);
15702
- await updateDoc21(clinicRef, {
15791
+ await updateDoc22(clinicRef, {
15703
15792
  isActive: false,
15704
15793
  updatedAt: serverTimestamp20()
15705
15794
  });
@@ -15709,7 +15798,7 @@ var ClinicService = class extends BaseService {
15709
15798
  */
15710
15799
  async activateClinic(clinicId, adminId) {
15711
15800
  const clinicRef = doc24(this.db, CLINICS_COLLECTION, clinicId);
15712
- await updateDoc21(clinicRef, {
15801
+ await updateDoc22(clinicRef, {
15713
15802
  isActive: true,
15714
15803
  updatedAt: serverTimestamp20()
15715
15804
  });
@@ -17046,7 +17135,7 @@ import {
17046
17135
  where as where27,
17047
17136
  getDocs as getDocs27,
17048
17137
  setDoc as setDoc22,
17049
- updateDoc as updateDoc28
17138
+ updateDoc as updateDoc29
17050
17139
  } from "firebase/firestore";
17051
17140
 
17052
17141
  // src/services/calendar/utils/clinic.utils.ts
@@ -17056,7 +17145,7 @@ import {
17056
17145
  getDoc as getDoc28,
17057
17146
  getDocs as getDocs22,
17058
17147
  setDoc as setDoc17,
17059
- updateDoc as updateDoc23,
17148
+ updateDoc as updateDoc24,
17060
17149
  deleteDoc as deleteDoc10,
17061
17150
  query as query22,
17062
17151
  where as where22,
@@ -17127,7 +17216,7 @@ async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData)
17127
17216
  ...updateData,
17128
17217
  updatedAt: serverTimestamp21()
17129
17218
  };
17130
- await updateDoc23(eventRef, updates);
17219
+ await updateDoc24(eventRef, updates);
17131
17220
  const updatedDoc = await getDoc28(eventRef);
17132
17221
  if (!updatedDoc.exists()) {
17133
17222
  throw new Error("Event not found after update");
@@ -17160,7 +17249,7 @@ import {
17160
17249
  getDoc as getDoc29,
17161
17250
  getDocs as getDocs23,
17162
17251
  setDoc as setDoc18,
17163
- updateDoc as updateDoc24,
17252
+ updateDoc as updateDoc25,
17164
17253
  deleteDoc as deleteDoc11,
17165
17254
  query as query23,
17166
17255
  where as where23,
@@ -17190,7 +17279,7 @@ async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData
17190
17279
  ...updateData,
17191
17280
  updatedAt: serverTimestamp22()
17192
17281
  };
17193
- await updateDoc24(eventRef, updates);
17282
+ await updateDoc25(eventRef, updates);
17194
17283
  const updatedDoc = await getDoc29(eventRef);
17195
17284
  if (!updatedDoc.exists()) {
17196
17285
  throw new Error("Event not found after update");
@@ -17204,7 +17293,7 @@ import {
17204
17293
  getDoc as getDoc30,
17205
17294
  getDocs as getDocs24,
17206
17295
  setDoc as setDoc19,
17207
- updateDoc as updateDoc25,
17296
+ updateDoc as updateDoc26,
17208
17297
  deleteDoc as deleteDoc12,
17209
17298
  query as query24,
17210
17299
  where as where24,
@@ -17242,7 +17331,7 @@ async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId,
17242
17331
  ...updateData,
17243
17332
  updatedAt: serverTimestamp23()
17244
17333
  };
17245
- await updateDoc25(eventRef, updates);
17334
+ await updateDoc26(eventRef, updates);
17246
17335
  const updatedDoc = await getDoc30(eventRef);
17247
17336
  if (!updatedDoc.exists()) {
17248
17337
  throw new Error("Event not found after update");
@@ -17307,7 +17396,7 @@ import {
17307
17396
  getDoc as getDoc31,
17308
17397
  getDocs as getDocs25,
17309
17398
  setDoc as setDoc20,
17310
- updateDoc as updateDoc26,
17399
+ updateDoc as updateDoc27,
17311
17400
  deleteDoc as deleteDoc13,
17312
17401
  query as query25,
17313
17402
  where as where25,
@@ -17435,7 +17524,7 @@ import {
17435
17524
  getDoc as getDoc32,
17436
17525
  getDocs as getDocs26,
17437
17526
  setDoc as setDoc21,
17438
- updateDoc as updateDoc27,
17527
+ updateDoc as updateDoc28,
17439
17528
  deleteDoc as deleteDoc14,
17440
17529
  query as query26,
17441
17530
  orderBy as orderBy12,
@@ -17559,7 +17648,7 @@ async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendar
17559
17648
  ...updateData,
17560
17649
  updatedAt: serverTimestamp25()
17561
17650
  };
17562
- await updateDoc27(calendarRef, updates);
17651
+ await updateDoc28(calendarRef, updates);
17563
17652
  const updatedDoc = await getDoc32(calendarRef);
17564
17653
  if (!updatedDoc.exists()) {
17565
17654
  throw new Error("Synced calendar not found after update");
@@ -17572,7 +17661,7 @@ async function updatePatientSyncedCalendarUtil(db, patientId, calendarId, update
17572
17661
  ...updateData,
17573
17662
  updatedAt: serverTimestamp25()
17574
17663
  };
17575
- await updateDoc27(calendarRef, updates);
17664
+ await updateDoc28(calendarRef, updates);
17576
17665
  const updatedDoc = await getDoc32(calendarRef);
17577
17666
  if (!updatedDoc.exists()) {
17578
17667
  throw new Error("Synced calendar not found after update");
@@ -17585,7 +17674,7 @@ async function updateClinicSyncedCalendarUtil(db, clinicId, calendarId, updateDa
17585
17674
  ...updateData,
17586
17675
  updatedAt: serverTimestamp25()
17587
17676
  };
17588
- await updateDoc27(calendarRef, updates);
17677
+ await updateDoc28(calendarRef, updates);
17589
17678
  const updatedDoc = await getDoc32(calendarRef);
17590
17679
  if (!updatedDoc.exists()) {
17591
17680
  throw new Error("Synced calendar not found after update");
@@ -19015,7 +19104,7 @@ var CalendarServiceV2 = class extends BaseService {
19015
19104
  CALENDAR_COLLECTION,
19016
19105
  eventId
19017
19106
  );
19018
- await updateDoc28(eventRef, {
19107
+ await updateDoc29(eventRef, {
19019
19108
  eventName: externalEvent.summary || "External Event",
19020
19109
  eventTime: {
19021
19110
  start: Timestamp30.fromDate(startTime),
@@ -19047,7 +19136,7 @@ var CalendarServiceV2 = class extends BaseService {
19047
19136
  CALENDAR_COLLECTION,
19048
19137
  eventId
19049
19138
  );
19050
- await updateDoc28(eventRef, {
19139
+ await updateDoc29(eventRef, {
19051
19140
  status,
19052
19141
  updatedAt: serverTimestamp26()
19053
19142
  });
@@ -19448,7 +19537,7 @@ var CalendarServiceV2 = class extends BaseService {
19448
19537
  } else {
19449
19538
  syncIds.push(syncEvent);
19450
19539
  }
19451
- await updateDoc28(eventRef, {
19540
+ await updateDoc29(eventRef, {
19452
19541
  syncedCalendarEventId: syncIds,
19453
19542
  updatedAt: serverTimestamp26()
19454
19543
  });
@@ -19674,7 +19763,7 @@ var CalendarServiceV2 = class extends BaseService {
19674
19763
 
19675
19764
  // src/services/calendar/calendar.v3.service.ts
19676
19765
  import { Timestamp as Timestamp31, serverTimestamp as serverTimestamp27 } from "firebase/firestore";
19677
- import { doc as doc33, getDoc as getDoc34, setDoc as setDoc23, updateDoc as updateDoc29, deleteDoc as deleteDoc15 } from "firebase/firestore";
19766
+ import { doc as doc33, getDoc as getDoc34, setDoc as setDoc23, updateDoc as updateDoc30, deleteDoc as deleteDoc15 } from "firebase/firestore";
19678
19767
  var CalendarServiceV3 = class extends BaseService {
19679
19768
  /**
19680
19769
  * Creates a new CalendarServiceV3 instance
@@ -19753,7 +19842,7 @@ var CalendarServiceV3 = class extends BaseService {
19753
19842
  if (params.status !== void 0) {
19754
19843
  updateData.status = params.status;
19755
19844
  }
19756
- await updateDoc29(eventRef, updateData);
19845
+ await updateDoc30(eventRef, updateData);
19757
19846
  const updatedEventDoc = await getDoc34(eventRef);
19758
19847
  return updatedEventDoc.data();
19759
19848
  }
@@ -19982,7 +20071,7 @@ import {
19982
20071
  getDocs as getDocs28,
19983
20072
  query as query28,
19984
20073
  where as where28,
19985
- updateDoc as updateDoc30,
20074
+ updateDoc as updateDoc31,
19986
20075
  setDoc as setDoc24,
19987
20076
  deleteDoc as deleteDoc16,
19988
20077
  Timestamp as Timestamp32,
@@ -20151,7 +20240,7 @@ var PractitionerInviteService = class extends BaseService {
20151
20240
  updatedAt: serverTimestamp28()
20152
20241
  };
20153
20242
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
20154
- await updateDoc30(docRef, updateData);
20243
+ await updateDoc31(docRef, updateData);
20155
20244
  return await this.getInviteById(inviteId);
20156
20245
  } catch (error) {
20157
20246
  console.error(
@@ -20183,7 +20272,7 @@ var PractitionerInviteService = class extends BaseService {
20183
20272
  updatedAt: serverTimestamp28()
20184
20273
  };
20185
20274
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
20186
- await updateDoc30(docRef, updateData);
20275
+ await updateDoc31(docRef, updateData);
20187
20276
  return await this.getInviteById(inviteId);
20188
20277
  } catch (error) {
20189
20278
  console.error(
@@ -20215,7 +20304,7 @@ var PractitionerInviteService = class extends BaseService {
20215
20304
  updatedAt: serverTimestamp28()
20216
20305
  };
20217
20306
  const docRef = doc34(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
20218
- await updateDoc30(docRef, updateData);
20307
+ await updateDoc31(docRef, updateData);
20219
20308
  return await this.getInviteById(inviteId);
20220
20309
  } catch (error) {
20221
20310
  console.error(
@@ -20386,7 +20475,7 @@ import {
20386
20475
  getDoc as getDoc36,
20387
20476
  getDocs as getDocs29,
20388
20477
  setDoc as setDoc25,
20389
- updateDoc as updateDoc31,
20478
+ updateDoc as updateDoc32,
20390
20479
  deleteDoc as deleteDoc17,
20391
20480
  query as query29,
20392
20481
  where as where29,
@@ -20516,7 +20605,7 @@ var DocumentationTemplateService = class extends BaseService {
20516
20605
  updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
20517
20606
  const docRef = doc35(this.collectionRef, templateId);
20518
20607
  console.log("Update payload", updatePayload);
20519
- await updateDoc31(docRef, updatePayload);
20608
+ await updateDoc32(docRef, updatePayload);
20520
20609
  return { ...template, ...updatePayload };
20521
20610
  }
20522
20611
  /**
@@ -20764,7 +20853,7 @@ import {
20764
20853
  getDoc as getDoc37,
20765
20854
  getDocs as getDocs30,
20766
20855
  setDoc as setDoc26,
20767
- updateDoc as updateDoc32,
20856
+ updateDoc as updateDoc33,
20768
20857
  query as query30,
20769
20858
  orderBy as orderBy15,
20770
20859
  limit as limit14,
@@ -20905,7 +20994,7 @@ var FilledDocumentService = class extends BaseService {
20905
20994
  }
20906
20995
  if (Object.keys(updatePayload).length === 1 && "updatedAt" in updatePayload) {
20907
20996
  }
20908
- await updateDoc32(docRef, updatePayload);
20997
+ await updateDoc33(docRef, updatePayload);
20909
20998
  return { ...existingDoc, ...updatePayload };
20910
20999
  }
20911
21000
  /**
@@ -21133,7 +21222,7 @@ import {
21133
21222
  getDocs as getDocs31,
21134
21223
  query as query31,
21135
21224
  where as where31,
21136
- updateDoc as updateDoc33,
21225
+ updateDoc as updateDoc34,
21137
21226
  deleteDoc as deleteDoc18,
21138
21227
  orderBy as orderBy16,
21139
21228
  Timestamp as Timestamp34,
@@ -21219,7 +21308,7 @@ var NotificationService = class extends BaseService {
21219
21308
  NOTIFICATIONS_COLLECTION,
21220
21309
  notificationId
21221
21310
  );
21222
- await updateDoc33(notificationRef, {
21311
+ await updateDoc34(notificationRef, {
21223
21312
  isRead: true,
21224
21313
  updatedAt: Timestamp34.now()
21225
21314
  });
@@ -21252,7 +21341,7 @@ var NotificationService = class extends BaseService {
21252
21341
  NOTIFICATIONS_COLLECTION,
21253
21342
  notificationId
21254
21343
  );
21255
- await updateDoc33(notificationRef, {
21344
+ await updateDoc34(notificationRef, {
21256
21345
  status,
21257
21346
  updatedAt: Timestamp34.now()
21258
21347
  });
@@ -21308,7 +21397,7 @@ import {
21308
21397
  query as query32,
21309
21398
  where as where32,
21310
21399
  doc as doc38,
21311
- updateDoc as updateDoc34,
21400
+ updateDoc as updateDoc35,
21312
21401
  Timestamp as Timestamp35,
21313
21402
  orderBy as orderBy17,
21314
21403
  limit as limit15,
@@ -21471,7 +21560,7 @@ var PatientRequirementsService = class extends BaseService {
21471
21560
  if (newOverallStatus !== instance.overallStatus) {
21472
21561
  updatePayload.overallStatus = newOverallStatus;
21473
21562
  }
21474
- await updateDoc34(instanceRef, updatePayload);
21563
+ await updateDoc35(instanceRef, updatePayload);
21475
21564
  return {
21476
21565
  ...instance,
21477
21566
  instructions: updatedInstructions,
@@ -21491,7 +21580,7 @@ import {
21491
21580
  getDocs as getDocs33,
21492
21581
  query as query33,
21493
21582
  where as where33,
21494
- updateDoc as updateDoc35,
21583
+ updateDoc as updateDoc36,
21495
21584
  setDoc as setDoc27,
21496
21585
  deleteDoc as deleteDoc19,
21497
21586
  serverTimestamp as serverTimestamp31,
@@ -22648,7 +22737,7 @@ var ProcedureService = class extends BaseService {
22648
22737
  } else if (validatedData.productId) {
22649
22738
  console.warn("Attempted to update product without a valid technologyId");
22650
22739
  }
22651
- await updateDoc35(procedureRef, {
22740
+ await updateDoc36(procedureRef, {
22652
22741
  ...updatedProcedureData,
22653
22742
  updatedAt: serverTimestamp31()
22654
22743
  });
@@ -22666,7 +22755,7 @@ var ProcedureService = class extends BaseService {
22666
22755
  console.warn(`Procedure ${id} not found for deactivation.`);
22667
22756
  return;
22668
22757
  }
22669
- await updateDoc35(procedureRef, {
22758
+ await updateDoc36(procedureRef, {
22670
22759
  isActive: false,
22671
22760
  updatedAt: serverTimestamp31()
22672
22761
  });
@@ -24054,7 +24143,7 @@ import {
24054
24143
  getDoc as getDoc42,
24055
24144
  getDocs as getDocs35,
24056
24145
  query as query35,
24057
- updateDoc as updateDoc36,
24146
+ updateDoc as updateDoc37,
24058
24147
  where as where35,
24059
24148
  limit as limit17,
24060
24149
  orderBy as orderBy19,
@@ -24167,7 +24256,7 @@ var BrandService = class extends BaseService {
24167
24256
  updateData.name_lowercase = brand.name.toLowerCase();
24168
24257
  }
24169
24258
  const docRef = doc41(this.getBrandsRef(), brandId);
24170
- await updateDoc36(docRef, updateData);
24259
+ await updateDoc37(docRef, updateData);
24171
24260
  return this.getById(brandId);
24172
24261
  }
24173
24262
  /**
@@ -24270,7 +24359,7 @@ import {
24270
24359
  orderBy as orderBy20,
24271
24360
  query as query36,
24272
24361
  startAfter as startAfter16,
24273
- updateDoc as updateDoc37,
24362
+ updateDoc as updateDoc38,
24274
24363
  where as where36
24275
24364
  } from "firebase/firestore";
24276
24365
 
@@ -24430,7 +24519,7 @@ var CategoryService = class extends BaseService {
24430
24519
  updatedAt: /* @__PURE__ */ new Date()
24431
24520
  };
24432
24521
  const docRef = doc42(this.categoriesRef, id);
24433
- await updateDoc37(docRef, updateData);
24522
+ await updateDoc38(docRef, updateData);
24434
24523
  return this.getById(id);
24435
24524
  }
24436
24525
  /**
@@ -24582,7 +24671,7 @@ import {
24582
24671
  query as query37,
24583
24672
  setDoc as setDoc29,
24584
24673
  startAfter as startAfter17,
24585
- updateDoc as updateDoc38,
24674
+ updateDoc as updateDoc39,
24586
24675
  where as where37
24587
24676
  } from "firebase/firestore";
24588
24677
 
@@ -24787,7 +24876,7 @@ var SubcategoryService = class extends BaseService {
24787
24876
  updatedAt: /* @__PURE__ */ new Date()
24788
24877
  };
24789
24878
  const docRef = doc43(this.getSubcategoriesRef(categoryId), subcategoryId);
24790
- await updateDoc38(docRef, updateData);
24879
+ await updateDoc39(docRef, updateData);
24791
24880
  return this.getById(categoryId, subcategoryId);
24792
24881
  }
24793
24882
  }
@@ -24943,7 +25032,7 @@ import {
24943
25032
  orderBy as orderBy22,
24944
25033
  query as query38,
24945
25034
  startAfter as startAfter18,
24946
- updateDoc as updateDoc39,
25035
+ updateDoc as updateDoc40,
24947
25036
  where as where38,
24948
25037
  arrayUnion as arrayUnion9,
24949
25038
  arrayRemove as arrayRemove8,
@@ -25140,7 +25229,7 @@ var TechnologyService = class extends BaseService {
25140
25229
  updateData.updatedAt = /* @__PURE__ */ new Date();
25141
25230
  const docRef = doc44(this.technologiesRef, id);
25142
25231
  const beforeTech = await this.getById(id);
25143
- await updateDoc39(docRef, updateData);
25232
+ await updateDoc40(docRef, updateData);
25144
25233
  const categoryChanged = beforeTech && updateData.categoryId && beforeTech.categoryId !== updateData.categoryId;
25145
25234
  const subcategoryChanged = beforeTech && updateData.subcategoryId && beforeTech.subcategoryId !== updateData.subcategoryId;
25146
25235
  const nameChanged = beforeTech && updateData.name && beforeTech.name !== updateData.name;
@@ -25227,7 +25316,7 @@ var TechnologyService = class extends BaseService {
25227
25316
  async addRequirement(technologyId, requirement) {
25228
25317
  const docRef = doc44(this.technologiesRef, technologyId);
25229
25318
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
25230
- await updateDoc39(docRef, {
25319
+ await updateDoc40(docRef, {
25231
25320
  [requirementType]: arrayUnion9(requirement),
25232
25321
  updatedAt: /* @__PURE__ */ new Date()
25233
25322
  });
@@ -25242,7 +25331,7 @@ var TechnologyService = class extends BaseService {
25242
25331
  async removeRequirement(technologyId, requirement) {
25243
25332
  const docRef = doc44(this.technologiesRef, technologyId);
25244
25333
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
25245
- await updateDoc39(docRef, {
25334
+ await updateDoc40(docRef, {
25246
25335
  [requirementType]: arrayRemove8(requirement),
25247
25336
  updatedAt: /* @__PURE__ */ new Date()
25248
25337
  });
@@ -25281,7 +25370,7 @@ var TechnologyService = class extends BaseService {
25281
25370
  */
25282
25371
  async addBlockingCondition(technologyId, condition) {
25283
25372
  const docRef = doc44(this.technologiesRef, technologyId);
25284
- await updateDoc39(docRef, {
25373
+ await updateDoc40(docRef, {
25285
25374
  blockingConditions: arrayUnion9(condition),
25286
25375
  updatedAt: /* @__PURE__ */ new Date()
25287
25376
  });
@@ -25295,7 +25384,7 @@ var TechnologyService = class extends BaseService {
25295
25384
  */
25296
25385
  async removeBlockingCondition(technologyId, condition) {
25297
25386
  const docRef = doc44(this.technologiesRef, technologyId);
25298
- await updateDoc39(docRef, {
25387
+ await updateDoc40(docRef, {
25299
25388
  blockingConditions: arrayRemove8(condition),
25300
25389
  updatedAt: /* @__PURE__ */ new Date()
25301
25390
  });
@@ -25317,7 +25406,7 @@ var TechnologyService = class extends BaseService {
25317
25406
  if (existingContraindications.some((c) => c.id === contraindication.id)) {
25318
25407
  return technology;
25319
25408
  }
25320
- await updateDoc39(docRef, {
25409
+ await updateDoc40(docRef, {
25321
25410
  contraindications: [...existingContraindications, contraindication],
25322
25411
  updatedAt: /* @__PURE__ */ new Date()
25323
25412
  });
@@ -25338,7 +25427,7 @@ var TechnologyService = class extends BaseService {
25338
25427
  const updatedContraindications = (technology.contraindications || []).filter(
25339
25428
  (c) => c.id !== contraindication.id
25340
25429
  );
25341
- await updateDoc39(docRef, {
25430
+ await updateDoc40(docRef, {
25342
25431
  contraindications: updatedContraindications,
25343
25432
  updatedAt: /* @__PURE__ */ new Date()
25344
25433
  });
@@ -25367,7 +25456,7 @@ var TechnologyService = class extends BaseService {
25367
25456
  }
25368
25457
  const updatedContraindications = [...contraindications];
25369
25458
  updatedContraindications[index] = contraindication;
25370
- await updateDoc39(docRef, {
25459
+ await updateDoc40(docRef, {
25371
25460
  contraindications: updatedContraindications,
25372
25461
  updatedAt: /* @__PURE__ */ new Date()
25373
25462
  });
@@ -25389,7 +25478,7 @@ var TechnologyService = class extends BaseService {
25389
25478
  if (existingBenefits.some((b) => b.id === benefit.id)) {
25390
25479
  return technology;
25391
25480
  }
25392
- await updateDoc39(docRef, {
25481
+ await updateDoc40(docRef, {
25393
25482
  benefits: [...existingBenefits, benefit],
25394
25483
  updatedAt: /* @__PURE__ */ new Date()
25395
25484
  });
@@ -25408,7 +25497,7 @@ var TechnologyService = class extends BaseService {
25408
25497
  throw new Error(`Technology with id ${technologyId} not found`);
25409
25498
  }
25410
25499
  const updatedBenefits = (technology.benefits || []).filter((b) => b.id !== benefit.id);
25411
- await updateDoc39(docRef, {
25500
+ await updateDoc40(docRef, {
25412
25501
  benefits: updatedBenefits,
25413
25502
  updatedAt: /* @__PURE__ */ new Date()
25414
25503
  });
@@ -25437,7 +25526,7 @@ var TechnologyService = class extends BaseService {
25437
25526
  }
25438
25527
  const updatedBenefits = [...benefits];
25439
25528
  updatedBenefits[index] = benefit;
25440
- await updateDoc39(docRef, {
25529
+ await updateDoc40(docRef, {
25441
25530
  benefits: updatedBenefits,
25442
25531
  updatedAt: /* @__PURE__ */ new Date()
25443
25532
  });
@@ -25478,7 +25567,7 @@ var TechnologyService = class extends BaseService {
25478
25567
  */
25479
25568
  async updateCertificationRequirement(technologyId, certificationRequirement) {
25480
25569
  const docRef = doc44(this.technologiesRef, technologyId);
25481
- await updateDoc39(docRef, {
25570
+ await updateDoc40(docRef, {
25482
25571
  certificationRequirement,
25483
25572
  updatedAt: /* @__PURE__ */ new Date()
25484
25573
  });
@@ -25858,7 +25947,7 @@ import {
25858
25947
  getDoc as getDoc46,
25859
25948
  getDocs as getDocs39,
25860
25949
  query as query39,
25861
- updateDoc as updateDoc40,
25950
+ updateDoc as updateDoc41,
25862
25951
  where as where39,
25863
25952
  limit as limit21,
25864
25953
  orderBy as orderBy23,
@@ -26027,7 +26116,7 @@ var ProductService = class extends BaseService {
26027
26116
  updatedAt: /* @__PURE__ */ new Date()
26028
26117
  };
26029
26118
  const docRef = doc45(this.getProductsRef(technologyId), productId);
26030
- await updateDoc40(docRef, updateData);
26119
+ await updateDoc41(docRef, updateData);
26031
26120
  return this.getById(technologyId, productId);
26032
26121
  }
26033
26122
  /**
@@ -26124,7 +26213,7 @@ var ProductService = class extends BaseService {
26124
26213
  updatedAt: /* @__PURE__ */ new Date()
26125
26214
  };
26126
26215
  const docRef = doc45(this.getTopLevelProductsRef(), productId);
26127
- await updateDoc40(docRef, updateData);
26216
+ await updateDoc41(docRef, updateData);
26128
26217
  return this.getByIdTopLevel(productId);
26129
26218
  }
26130
26219
  /**
@@ -26140,7 +26229,7 @@ var ProductService = class extends BaseService {
26140
26229
  */
26141
26230
  async assignToTechnology(productId, technologyId) {
26142
26231
  const docRef = doc45(this.getTopLevelProductsRef(), productId);
26143
- await updateDoc40(docRef, {
26232
+ await updateDoc41(docRef, {
26144
26233
  assignedTechnologyIds: arrayUnion10(technologyId),
26145
26234
  updatedAt: /* @__PURE__ */ new Date()
26146
26235
  });
@@ -26150,7 +26239,7 @@ var ProductService = class extends BaseService {
26150
26239
  */
26151
26240
  async unassignFromTechnology(productId, technologyId) {
26152
26241
  const docRef = doc45(this.getTopLevelProductsRef(), productId);
26153
- await updateDoc40(docRef, {
26242
+ await updateDoc41(docRef, {
26154
26243
  assignedTechnologyIds: arrayRemove9(technologyId),
26155
26244
  updatedAt: /* @__PURE__ */ new Date()
26156
26245
  });
@@ -26296,7 +26385,7 @@ import {
26296
26385
  doc as doc46,
26297
26386
  getDoc as getDoc47,
26298
26387
  setDoc as setDoc30,
26299
- updateDoc as updateDoc41
26388
+ updateDoc as updateDoc42
26300
26389
  } from "firebase/firestore";
26301
26390
  var ADMIN_CONSTANTS_COLLECTION = "admin-constants";
26302
26391
  var TREATMENT_BENEFITS_DOC = "treatment-benefits";
@@ -26359,7 +26448,7 @@ var ConstantsService = class extends BaseService {
26359
26448
  if (!docSnap.exists()) {
26360
26449
  await setDoc30(this.treatmentBenefitsDocRef, { benefits: [newBenefit] });
26361
26450
  } else {
26362
- await updateDoc41(this.treatmentBenefitsDocRef, {
26451
+ await updateDoc42(this.treatmentBenefitsDocRef, {
26363
26452
  benefits: arrayUnion11(newBenefit)
26364
26453
  });
26365
26454
  }
@@ -26399,7 +26488,7 @@ var ConstantsService = class extends BaseService {
26399
26488
  throw new Error("Treatment benefit not found.");
26400
26489
  }
26401
26490
  benefits[benefitIndex] = benefit;
26402
- await updateDoc41(this.treatmentBenefitsDocRef, { benefits });
26491
+ await updateDoc42(this.treatmentBenefitsDocRef, { benefits });
26403
26492
  return benefit;
26404
26493
  }
26405
26494
  /**
@@ -26413,7 +26502,7 @@ var ConstantsService = class extends BaseService {
26413
26502
  if (!benefitToRemove) {
26414
26503
  return;
26415
26504
  }
26416
- await updateDoc41(this.treatmentBenefitsDocRef, {
26505
+ await updateDoc42(this.treatmentBenefitsDocRef, {
26417
26506
  benefits: arrayRemove10(benefitToRemove)
26418
26507
  });
26419
26508
  }
@@ -26466,7 +26555,7 @@ var ConstantsService = class extends BaseService {
26466
26555
  contraindications: [newContraindication]
26467
26556
  });
26468
26557
  } else {
26469
- await updateDoc41(this.contraindicationsDocRef, {
26558
+ await updateDoc42(this.contraindicationsDocRef, {
26470
26559
  contraindications: arrayUnion11(newContraindication)
26471
26560
  });
26472
26561
  }
@@ -26508,7 +26597,7 @@ var ConstantsService = class extends BaseService {
26508
26597
  throw new Error("Contraindication not found.");
26509
26598
  }
26510
26599
  contraindications[index] = contraindication;
26511
- await updateDoc41(this.contraindicationsDocRef, { contraindications });
26600
+ await updateDoc42(this.contraindicationsDocRef, { contraindications });
26512
26601
  return contraindication;
26513
26602
  }
26514
26603
  /**
@@ -26522,7 +26611,7 @@ var ConstantsService = class extends BaseService {
26522
26611
  if (!toRemove) {
26523
26612
  return;
26524
26613
  }
26525
- await updateDoc41(this.contraindicationsDocRef, {
26614
+ await updateDoc42(this.contraindicationsDocRef, {
26526
26615
  contraindications: arrayRemove10(toRemove)
26527
26616
  });
26528
26617
  }