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