@blackcode_sa/metaestetics-api 1.7.26 → 1.7.27

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
@@ -1296,7 +1296,7 @@ var MediaService = class extends BaseService {
1296
1296
  try {
1297
1297
  const querySnapshot = await getDocs(finalQuery);
1298
1298
  const mediaList = querySnapshot.docs.map(
1299
- (doc35) => doc35.data()
1299
+ (doc36) => doc36.data()
1300
1300
  );
1301
1301
  console.log(`[MediaService] Found ${mediaList.length} media items.`);
1302
1302
  return mediaList;
@@ -1977,8 +1977,8 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
1977
1977
  }
1978
1978
  const patientsSnapshot = await getDocs3(q);
1979
1979
  const patients = [];
1980
- patientsSnapshot.forEach((doc35) => {
1981
- patients.push(doc35.data());
1980
+ patientsSnapshot.forEach((doc36) => {
1981
+ patients.push(doc36.data());
1982
1982
  });
1983
1983
  console.log(
1984
1984
  `[getPatientsByPractitionerUtil] Found ${patients.length} patients for practitioner ID: ${practitionerId}`
@@ -2208,9 +2208,9 @@ var updateAllergyUtil = async (db, patientId, data, userRef) => {
2208
2208
  });
2209
2209
  };
2210
2210
  var removeAllergyUtil = async (db, patientId, allergyIndex, userRef) => {
2211
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
- if (!doc35.exists()) throw new Error("Medical info not found");
2213
- const medicalInfo = doc35.data();
2211
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
+ if (!doc36.exists()) throw new Error("Medical info not found");
2213
+ const medicalInfo = doc36.data();
2214
2214
  if (allergyIndex >= medicalInfo.allergies.length) {
2215
2215
  throw new Error("Invalid allergy index");
2216
2216
  }
@@ -2235,9 +2235,9 @@ var addBlockingConditionUtil = async (db, patientId, data, userRef) => {
2235
2235
  var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
2236
2236
  const validatedData = updateBlockingConditionSchema.parse(data);
2237
2237
  const { conditionIndex, ...updateData } = validatedData;
2238
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
- if (!doc35.exists()) throw new Error("Medical info not found");
2240
- const medicalInfo = doc35.data();
2238
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
+ if (!doc36.exists()) throw new Error("Medical info not found");
2240
+ const medicalInfo = doc36.data();
2241
2241
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
2242
2242
  throw new Error("Invalid blocking condition index");
2243
2243
  }
@@ -2253,9 +2253,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
2253
2253
  });
2254
2254
  };
2255
2255
  var removeBlockingConditionUtil = async (db, patientId, conditionIndex, userRef) => {
2256
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
- if (!doc35.exists()) throw new Error("Medical info not found");
2258
- const medicalInfo = doc35.data();
2256
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
+ if (!doc36.exists()) throw new Error("Medical info not found");
2258
+ const medicalInfo = doc36.data();
2259
2259
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
2260
2260
  throw new Error("Invalid blocking condition index");
2261
2261
  }
@@ -2280,9 +2280,9 @@ var addContraindicationUtil = async (db, patientId, data, userRef) => {
2280
2280
  var updateContraindicationUtil = async (db, patientId, data, userRef) => {
2281
2281
  const validatedData = updateContraindicationSchema.parse(data);
2282
2282
  const { contraindicationIndex, ...updateData } = validatedData;
2283
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
- if (!doc35.exists()) throw new Error("Medical info not found");
2285
- const medicalInfo = doc35.data();
2283
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
+ if (!doc36.exists()) throw new Error("Medical info not found");
2285
+ const medicalInfo = doc36.data();
2286
2286
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
2287
2287
  throw new Error("Invalid contraindication index");
2288
2288
  }
@@ -2298,9 +2298,9 @@ var updateContraindicationUtil = async (db, patientId, data, userRef) => {
2298
2298
  });
2299
2299
  };
2300
2300
  var removeContraindicationUtil = async (db, patientId, contraindicationIndex, userRef) => {
2301
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
- if (!doc35.exists()) throw new Error("Medical info not found");
2303
- const medicalInfo = doc35.data();
2301
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
+ if (!doc36.exists()) throw new Error("Medical info not found");
2303
+ const medicalInfo = doc36.data();
2304
2304
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
2305
2305
  throw new Error("Invalid contraindication index");
2306
2306
  }
@@ -2325,9 +2325,9 @@ var addMedicationUtil = async (db, patientId, data, userRef) => {
2325
2325
  var updateMedicationUtil = async (db, patientId, data, userRef) => {
2326
2326
  const validatedData = updateMedicationSchema.parse(data);
2327
2327
  const { medicationIndex, ...updateData } = validatedData;
2328
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
- if (!doc35.exists()) throw new Error("Medical info not found");
2330
- const medicalInfo = doc35.data();
2328
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
+ if (!doc36.exists()) throw new Error("Medical info not found");
2330
+ const medicalInfo = doc36.data();
2331
2331
  if (medicationIndex >= medicalInfo.currentMedications.length) {
2332
2332
  throw new Error("Invalid medication index");
2333
2333
  }
@@ -2343,9 +2343,9 @@ var updateMedicationUtil = async (db, patientId, data, userRef) => {
2343
2343
  });
2344
2344
  };
2345
2345
  var removeMedicationUtil = async (db, patientId, medicationIndex, userRef) => {
2346
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
- if (!doc35.exists()) throw new Error("Medical info not found");
2348
- const medicalInfo = doc35.data();
2346
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
+ if (!doc36.exists()) throw new Error("Medical info not found");
2348
+ const medicalInfo = doc36.data();
2349
2349
  if (medicationIndex >= medicalInfo.currentMedications.length) {
2350
2350
  throw new Error("Invalid medication index");
2351
2351
  }
@@ -2624,7 +2624,7 @@ var searchPatientsUtil = async (db, params, requester) => {
2624
2624
  const finalQuery = query4(patientsCollectionRef, ...constraints);
2625
2625
  const querySnapshot = await getDocs4(finalQuery);
2626
2626
  const patients = querySnapshot.docs.map(
2627
- (doc35) => doc35.data()
2627
+ (doc36) => doc36.data()
2628
2628
  );
2629
2629
  console.log(
2630
2630
  `[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
@@ -2656,8 +2656,8 @@ var getAllPatientsUtil = async (db, options) => {
2656
2656
  }
2657
2657
  const patientsSnapshot = await getDocs4(q);
2658
2658
  const patients = [];
2659
- patientsSnapshot.forEach((doc35) => {
2660
- patients.push(doc35.data());
2659
+ patientsSnapshot.forEach((doc36) => {
2660
+ patients.push(doc36.data());
2661
2661
  });
2662
2662
  console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
2663
2663
  return patients;
@@ -2890,8 +2890,8 @@ var getPatientsByClinicUtil = async (db, clinicId, options) => {
2890
2890
  }
2891
2891
  const patientsSnapshot = await getDocs5(q);
2892
2892
  const patients = [];
2893
- patientsSnapshot.forEach((doc35) => {
2894
- patients.push(doc35.data());
2893
+ patientsSnapshot.forEach((doc36) => {
2894
+ patients.push(doc36.data());
2895
2895
  });
2896
2896
  console.log(
2897
2897
  `[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
@@ -4171,7 +4171,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
4171
4171
  where6("clinicGroupId", "==", clinicGroupId)
4172
4172
  );
4173
4173
  const querySnapshot = await getDocs6(q);
4174
- return querySnapshot.docs.map((doc35) => doc35.data());
4174
+ return querySnapshot.docs.map((doc36) => doc36.data());
4175
4175
  }
4176
4176
  async function updateClinicAdmin(db, adminId, data) {
4177
4177
  const admin = await getClinicAdmin(db, adminId);
@@ -4925,7 +4925,7 @@ var PractitionerService = class extends BaseService {
4925
4925
  where7("expiresAt", ">", Timestamp10.now())
4926
4926
  );
4927
4927
  const querySnapshot = await getDocs7(q);
4928
- return querySnapshot.docs.map((doc35) => doc35.data());
4928
+ return querySnapshot.docs.map((doc36) => doc36.data());
4929
4929
  }
4930
4930
  /**
4931
4931
  * Gets a token by its string value and validates it
@@ -5035,7 +5035,7 @@ var PractitionerService = class extends BaseService {
5035
5035
  where7("status", "==", "active" /* ACTIVE */)
5036
5036
  );
5037
5037
  const querySnapshot = await getDocs7(q);
5038
- return querySnapshot.docs.map((doc35) => doc35.data());
5038
+ return querySnapshot.docs.map((doc36) => doc36.data());
5039
5039
  }
5040
5040
  /**
5041
5041
  * Dohvata sve zdravstvene radnike za određenu kliniku
@@ -5047,7 +5047,7 @@ var PractitionerService = class extends BaseService {
5047
5047
  where7("isActive", "==", true)
5048
5048
  );
5049
5049
  const querySnapshot = await getDocs7(q);
5050
- return querySnapshot.docs.map((doc35) => doc35.data());
5050
+ return querySnapshot.docs.map((doc36) => doc36.data());
5051
5051
  }
5052
5052
  /**
5053
5053
  * Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
@@ -5059,7 +5059,7 @@ var PractitionerService = class extends BaseService {
5059
5059
  where7("status", "==", "draft" /* DRAFT */)
5060
5060
  );
5061
5061
  const querySnapshot = await getDocs7(q);
5062
- return querySnapshot.docs.map((doc35) => doc35.data());
5062
+ return querySnapshot.docs.map((doc36) => doc36.data());
5063
5063
  }
5064
5064
  /**
5065
5065
  * Updates a practitioner
@@ -5273,7 +5273,7 @@ var PractitionerService = class extends BaseService {
5273
5273
  );
5274
5274
  const querySnapshot = await getDocs7(q);
5275
5275
  const practitioners = querySnapshot.docs.map(
5276
- (doc35) => doc35.data()
5276
+ (doc36) => doc36.data()
5277
5277
  );
5278
5278
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5279
5279
  return {
@@ -5344,8 +5344,8 @@ var PractitionerService = class extends BaseService {
5344
5344
  console.log(
5345
5345
  `[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
5346
5346
  );
5347
- let practitioners = querySnapshot.docs.map((doc35) => {
5348
- return { ...doc35.data(), id: doc35.id };
5347
+ let practitioners = querySnapshot.docs.map((doc36) => {
5348
+ return { ...doc36.data(), id: doc36.id };
5349
5349
  });
5350
5350
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5351
5351
  if (filters.nameSearch && filters.nameSearch.trim() !== "") {
@@ -5602,7 +5602,7 @@ var UserService = class extends BaseService {
5602
5602
  ];
5603
5603
  const q = query8(collection8(this.db, USERS_COLLECTION), ...constraints);
5604
5604
  const querySnapshot = await getDocs8(q);
5605
- const users = querySnapshot.docs.map((doc35) => doc35.data());
5605
+ const users = querySnapshot.docs.map((doc36) => doc36.data());
5606
5606
  return Promise.all(users.map((userData) => userSchema.parse(userData)));
5607
5607
  }
5608
5608
  /**
@@ -5982,7 +5982,7 @@ async function getAllActiveGroups(db) {
5982
5982
  where9("isActive", "==", true)
5983
5983
  );
5984
5984
  const querySnapshot = await getDocs9(q);
5985
- return querySnapshot.docs.map((doc35) => doc35.data());
5985
+ return querySnapshot.docs.map((doc36) => doc36.data());
5986
5986
  }
5987
5987
  async function updateClinicGroup(db, groupId, data, app) {
5988
5988
  console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
@@ -6447,7 +6447,7 @@ async function getClinicsByGroup(db, groupId) {
6447
6447
  where10("isActive", "==", true)
6448
6448
  );
6449
6449
  const querySnapshot = await getDocs10(q);
6450
- return querySnapshot.docs.map((doc35) => doc35.data());
6450
+ return querySnapshot.docs.map((doc36) => doc36.data());
6451
6451
  }
6452
6452
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
6453
6453
  console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
@@ -6641,7 +6641,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
6641
6641
  }
6642
6642
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6643
6643
  const querySnapshot = await getDocs10(q);
6644
- return querySnapshot.docs.map((doc35) => doc35.data());
6644
+ return querySnapshot.docs.map((doc36) => doc36.data());
6645
6645
  }
6646
6646
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
6647
6647
  return getClinicsByAdmin(
@@ -6686,11 +6686,11 @@ async function getAllClinics(db, pagination, lastDoc) {
6686
6686
  }
6687
6687
  const clinicsSnapshot = await getDocs10(clinicsQuery);
6688
6688
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
6689
- const clinics = clinicsSnapshot.docs.map((doc35) => {
6690
- const data = doc35.data();
6689
+ const clinics = clinicsSnapshot.docs.map((doc36) => {
6690
+ const data = doc36.data();
6691
6691
  return {
6692
6692
  ...data,
6693
- id: doc35.id
6693
+ id: doc36.id
6694
6694
  };
6695
6695
  });
6696
6696
  return {
@@ -6717,8 +6717,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
6717
6717
  ];
6718
6718
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6719
6719
  const querySnapshot = await getDocs10(q);
6720
- for (const doc35 of querySnapshot.docs) {
6721
- const clinic = doc35.data();
6720
+ for (const doc36 of querySnapshot.docs) {
6721
+ const clinic = doc36.data();
6722
6722
  const distance = distanceBetween2(
6723
6723
  [center.latitude, center.longitude],
6724
6724
  [clinic.location.latitude, clinic.location.longitude]
@@ -6840,8 +6840,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
6840
6840
  }
6841
6841
  const q = query11(collection11(db, CLINICS_COLLECTION), ...constraints);
6842
6842
  const querySnapshot = await getDocs11(q);
6843
- for (const doc35 of querySnapshot.docs) {
6844
- const clinic = doc35.data();
6843
+ for (const doc36 of querySnapshot.docs) {
6844
+ const clinic = doc36.data();
6845
6845
  const distance = distanceBetween3(
6846
6846
  [center.latitude, center.longitude],
6847
6847
  [clinic.location.latitude, clinic.location.longitude]
@@ -6937,8 +6937,8 @@ async function getClinicsByFilters(db, filters) {
6937
6937
  console.log(
6938
6938
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
6939
6939
  );
6940
- for (const doc35 of querySnapshot.docs) {
6941
- const clinic = { ...doc35.data(), id: doc35.id };
6940
+ for (const doc36 of querySnapshot.docs) {
6941
+ const clinic = { ...doc36.data(), id: doc36.id };
6942
6942
  const distance = distanceBetween4(
6943
6943
  [center.latitude, center.longitude],
6944
6944
  [clinic.location.latitude, clinic.location.longitude]
@@ -6994,8 +6994,8 @@ async function getClinicsByFilters(db, filters) {
6994
6994
  console.log(
6995
6995
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
6996
6996
  );
6997
- const clinics = querySnapshot.docs.map((doc35) => {
6998
- return { ...doc35.data(), id: doc35.id };
6997
+ const clinics = querySnapshot.docs.map((doc36) => {
6998
+ return { ...doc36.data(), id: doc36.id };
6999
6999
  });
7000
7000
  let filteredClinics = clinics;
7001
7001
  if (filters.center) {
@@ -8442,9 +8442,9 @@ var NotificationService = class extends BaseService {
8442
8442
  orderBy4("notificationTime", "desc")
8443
8443
  );
8444
8444
  const querySnapshot = await getDocs15(q);
8445
- return querySnapshot.docs.map((doc35) => ({
8446
- id: doc35.id,
8447
- ...doc35.data()
8445
+ return querySnapshot.docs.map((doc36) => ({
8446
+ id: doc36.id,
8447
+ ...doc36.data()
8448
8448
  }));
8449
8449
  }
8450
8450
  /**
@@ -8458,9 +8458,9 @@ var NotificationService = class extends BaseService {
8458
8458
  orderBy4("notificationTime", "desc")
8459
8459
  );
8460
8460
  const querySnapshot = await getDocs15(q);
8461
- return querySnapshot.docs.map((doc35) => ({
8462
- id: doc35.id,
8463
- ...doc35.data()
8461
+ return querySnapshot.docs.map((doc36) => ({
8462
+ id: doc36.id,
8463
+ ...doc36.data()
8464
8464
  }));
8465
8465
  }
8466
8466
  /**
@@ -8532,9 +8532,9 @@ var NotificationService = class extends BaseService {
8532
8532
  orderBy4("notificationTime", "desc")
8533
8533
  );
8534
8534
  const querySnapshot = await getDocs15(q);
8535
- return querySnapshot.docs.map((doc35) => ({
8536
- id: doc35.id,
8537
- ...doc35.data()
8535
+ return querySnapshot.docs.map((doc36) => ({
8536
+ id: doc36.id,
8537
+ ...doc36.data()
8538
8538
  }));
8539
8539
  }
8540
8540
  /**
@@ -8547,9 +8547,9 @@ var NotificationService = class extends BaseService {
8547
8547
  orderBy4("notificationTime", "desc")
8548
8548
  );
8549
8549
  const querySnapshot = await getDocs15(q);
8550
- return querySnapshot.docs.map((doc35) => ({
8551
- id: doc35.id,
8552
- ...doc35.data()
8550
+ return querySnapshot.docs.map((doc36) => ({
8551
+ id: doc36.id,
8552
+ ...doc36.data()
8553
8553
  }));
8554
8554
  }
8555
8555
  };
@@ -8844,7 +8844,7 @@ var ProcedureService = class extends BaseService {
8844
8844
  where16("isActive", "==", true)
8845
8845
  );
8846
8846
  const snapshot = await getDocs16(q);
8847
- return snapshot.docs.map((doc35) => doc35.data());
8847
+ return snapshot.docs.map((doc36) => doc36.data());
8848
8848
  }
8849
8849
  /**
8850
8850
  * Gets all procedures for a practitioner
@@ -8858,7 +8858,7 @@ var ProcedureService = class extends BaseService {
8858
8858
  where16("isActive", "==", true)
8859
8859
  );
8860
8860
  const snapshot = await getDocs16(q);
8861
- return snapshot.docs.map((doc35) => doc35.data());
8861
+ return snapshot.docs.map((doc36) => doc36.data());
8862
8862
  }
8863
8863
  /**
8864
8864
  * Updates a procedure
@@ -9070,11 +9070,11 @@ var ProcedureService = class extends BaseService {
9070
9070
  }
9071
9071
  const proceduresSnapshot = await getDocs16(proceduresQuery);
9072
9072
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
9073
- const procedures = proceduresSnapshot.docs.map((doc35) => {
9074
- const data = doc35.data();
9073
+ const procedures = proceduresSnapshot.docs.map((doc36) => {
9074
+ const data = doc36.data();
9075
9075
  return {
9076
9076
  ...data,
9077
- id: doc35.id
9077
+ id: doc36.id
9078
9078
  // Ensure ID is present
9079
9079
  };
9080
9080
  });
@@ -9156,8 +9156,8 @@ var ProcedureService = class extends BaseService {
9156
9156
  console.log(
9157
9157
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
9158
9158
  );
9159
- for (const doc35 of querySnapshot.docs) {
9160
- const procedure = { ...doc35.data(), id: doc35.id };
9159
+ for (const doc36 of querySnapshot.docs) {
9160
+ const procedure = { ...doc36.data(), id: doc36.id };
9161
9161
  const distance = distanceBetween6(
9162
9162
  [center.latitude, center.longitude],
9163
9163
  [
@@ -9208,8 +9208,8 @@ var ProcedureService = class extends BaseService {
9208
9208
  console.log(
9209
9209
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
9210
9210
  );
9211
- const procedures = querySnapshot.docs.map((doc35) => {
9212
- return { ...doc35.data(), id: doc35.id };
9211
+ const procedures = querySnapshot.docs.map((doc36) => {
9212
+ return { ...doc36.data(), id: doc36.id };
9213
9213
  });
9214
9214
  if (filters.location) {
9215
9215
  const center = filters.location;
@@ -9434,7 +9434,7 @@ var PractitionerInviteService = class extends BaseService {
9434
9434
  ...constraints
9435
9435
  );
9436
9436
  const querySnapshot = await getDocs17(q);
9437
- return querySnapshot.docs.map((doc35) => doc35.data());
9437
+ return querySnapshot.docs.map((doc36) => doc36.data());
9438
9438
  } catch (error) {
9439
9439
  console.error(
9440
9440
  "[PractitionerInviteService] Error getting doctor invites:",
@@ -9463,7 +9463,7 @@ var PractitionerInviteService = class extends BaseService {
9463
9463
  ...constraints
9464
9464
  );
9465
9465
  const querySnapshot = await getDocs17(q);
9466
- return querySnapshot.docs.map((doc35) => doc35.data());
9466
+ return querySnapshot.docs.map((doc36) => doc36.data());
9467
9467
  } catch (error) {
9468
9468
  console.error(
9469
9469
  "[PractitionerInviteService] Error getting clinic invites:",
@@ -9619,7 +9619,7 @@ var PractitionerInviteService = class extends BaseService {
9619
9619
  );
9620
9620
  const querySnapshot = await getDocs17(q);
9621
9621
  let invites = querySnapshot.docs.map(
9622
- (doc35) => doc35.data()
9622
+ (doc36) => doc36.data()
9623
9623
  );
9624
9624
  if (filters.fromDate) {
9625
9625
  invites = invites.filter(
@@ -9889,8 +9889,8 @@ var DocumentationTemplateService = class extends BaseService {
9889
9889
  const q = query18(versionsCollectionRef, orderBy7("version", "desc"));
9890
9890
  const querySnapshot = await getDocs18(q);
9891
9891
  const versions = [];
9892
- querySnapshot.forEach((doc35) => {
9893
- versions.push(doc35.data());
9892
+ querySnapshot.forEach((doc36) => {
9893
+ versions.push(doc36.data());
9894
9894
  });
9895
9895
  return versions;
9896
9896
  }
@@ -9921,9 +9921,9 @@ var DocumentationTemplateService = class extends BaseService {
9921
9921
  const querySnapshot = await getDocs18(q);
9922
9922
  const templates = [];
9923
9923
  let lastVisible = null;
9924
- querySnapshot.forEach((doc35) => {
9925
- templates.push(doc35.data());
9926
- lastVisible = doc35;
9924
+ querySnapshot.forEach((doc36) => {
9925
+ templates.push(doc36.data());
9926
+ lastVisible = doc36;
9927
9927
  });
9928
9928
  return {
9929
9929
  templates,
@@ -9951,9 +9951,9 @@ var DocumentationTemplateService = class extends BaseService {
9951
9951
  const querySnapshot = await getDocs18(q);
9952
9952
  const templates = [];
9953
9953
  let lastVisible = null;
9954
- querySnapshot.forEach((doc35) => {
9955
- templates.push(doc35.data());
9956
- lastVisible = doc35;
9954
+ querySnapshot.forEach((doc36) => {
9955
+ templates.push(doc36.data());
9956
+ lastVisible = doc36;
9957
9957
  });
9958
9958
  return {
9959
9959
  templates,
@@ -9980,9 +9980,9 @@ var DocumentationTemplateService = class extends BaseService {
9980
9980
  const querySnapshot = await getDocs18(q);
9981
9981
  const templates = [];
9982
9982
  let lastVisible = null;
9983
- querySnapshot.forEach((doc35) => {
9984
- templates.push(doc35.data());
9985
- lastVisible = doc35;
9983
+ querySnapshot.forEach((doc36) => {
9984
+ templates.push(doc36.data());
9985
+ lastVisible = doc36;
9986
9986
  });
9987
9987
  return {
9988
9988
  templates,
@@ -10008,8 +10008,8 @@ var DocumentationTemplateService = class extends BaseService {
10008
10008
  }
10009
10009
  const querySnapshot = await getDocs18(q);
10010
10010
  const templates = [];
10011
- querySnapshot.forEach((doc35) => {
10012
- templates.push(doc35.data());
10011
+ querySnapshot.forEach((doc36) => {
10012
+ templates.push(doc36.data());
10013
10013
  });
10014
10014
  return templates;
10015
10015
  }
@@ -10215,9 +10215,9 @@ var FilledDocumentService = class extends BaseService {
10215
10215
  const querySnapshot = await getDocs19(q);
10216
10216
  const documents = [];
10217
10217
  let lastVisible = null;
10218
- querySnapshot.forEach((doc35) => {
10219
- documents.push(doc35.data());
10220
- lastVisible = doc35;
10218
+ querySnapshot.forEach((doc36) => {
10219
+ documents.push(doc36.data());
10220
+ lastVisible = doc36;
10221
10221
  });
10222
10222
  return {
10223
10223
  documents,
@@ -10572,6 +10572,28 @@ var calendarEventSchema = z23.object({
10572
10572
  createdAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21)),
10573
10573
  updatedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21))
10574
10574
  });
10575
+ var createBlockingEventSchema = z23.object({
10576
+ entityType: z23.enum(["practitioner", "clinic"]),
10577
+ entityId: z23.string().min(1, "Entity ID is required"),
10578
+ eventName: z23.string().min(1, "Event name is required").max(200, "Event name too long"),
10579
+ eventTime: calendarEventTimeSchema,
10580
+ eventType: z23.enum([
10581
+ "blocking" /* BLOCKING */,
10582
+ "break" /* BREAK */,
10583
+ "free_day" /* FREE_DAY */,
10584
+ "other" /* OTHER */
10585
+ ]),
10586
+ description: z23.string().max(1e3, "Description too long").optional()
10587
+ });
10588
+ var updateBlockingEventSchema = z23.object({
10589
+ entityType: z23.enum(["practitioner", "clinic"]),
10590
+ entityId: z23.string().min(1, "Entity ID is required"),
10591
+ eventId: z23.string().min(1, "Event ID is required"),
10592
+ eventName: z23.string().min(1, "Event name is required").max(200, "Event name too long").optional(),
10593
+ eventTime: calendarEventTimeSchema.optional(),
10594
+ description: z23.string().max(1e3, "Description too long").optional(),
10595
+ status: z23.nativeEnum(CalendarEventStatus).optional()
10596
+ });
10575
10597
 
10576
10598
  // src/services/calendar/utils/clinic.utils.ts
10577
10599
  import {
@@ -10922,7 +10944,7 @@ async function searchCalendarEventsUtil(db, params) {
10922
10944
  const finalQuery = query23(collectionRef, ...constraints);
10923
10945
  const querySnapshot = await getDocs23(finalQuery);
10924
10946
  const events = querySnapshot.docs.map(
10925
- (doc35) => ({ id: doc35.id, ...doc35.data() })
10947
+ (doc36) => ({ id: doc36.id, ...doc36.data() })
10926
10948
  );
10927
10949
  return events;
10928
10950
  } catch (error) {
@@ -11015,7 +11037,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
11015
11037
  );
11016
11038
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11017
11039
  const querySnapshot = await getDocs24(q);
11018
- return querySnapshot.docs.map((doc35) => doc35.data());
11040
+ return querySnapshot.docs.map((doc36) => doc36.data());
11019
11041
  }
11020
11042
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
11021
11043
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
@@ -11032,7 +11054,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
11032
11054
  );
11033
11055
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11034
11056
  const querySnapshot = await getDocs24(q);
11035
- return querySnapshot.docs.map((doc35) => doc35.data());
11057
+ return querySnapshot.docs.map((doc36) => doc36.data());
11036
11058
  }
11037
11059
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
11038
11060
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
@@ -11049,7 +11071,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
11049
11071
  );
11050
11072
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11051
11073
  const querySnapshot = await getDocs24(q);
11052
- return querySnapshot.docs.map((doc35) => doc35.data());
11074
+ return querySnapshot.docs.map((doc36) => doc36.data());
11053
11075
  }
11054
11076
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
11055
11077
  const calendarRef = getPractitionerSyncedCalendarDocRef(
@@ -12404,9 +12426,9 @@ var CalendarServiceV2 = class extends BaseService {
12404
12426
  where25("eventTime.start", "<=", Timestamp28.fromDate(endDate))
12405
12427
  );
12406
12428
  const eventsSnapshot = await getDocs25(q);
12407
- const events = eventsSnapshot.docs.map((doc35) => ({
12408
- id: doc35.id,
12409
- ...doc35.data()
12429
+ const events = eventsSnapshot.docs.map((doc36) => ({
12430
+ id: doc36.id,
12431
+ ...doc36.data()
12410
12432
  }));
12411
12433
  const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
12412
12434
  doctorId
@@ -13040,7 +13062,7 @@ var CalendarServiceV2 = class extends BaseService {
13040
13062
  ])
13041
13063
  );
13042
13064
  const querySnapshot = await getDocs25(q);
13043
- return querySnapshot.docs.map((doc35) => doc35.data());
13065
+ return querySnapshot.docs.map((doc36) => doc36.data());
13044
13066
  }
13045
13067
  /**
13046
13068
  * Calculates available time slots based on working hours, schedule and existing appointments
@@ -13164,17 +13186,214 @@ var CalendarServiceV2 = class extends BaseService {
13164
13186
  // #endregion
13165
13187
  };
13166
13188
 
13189
+ // src/services/calendar/calendar.v3.service.ts
13190
+ import { Timestamp as Timestamp29, serverTimestamp as serverTimestamp23 } from "firebase/firestore";
13191
+ import { doc as doc27, getDoc as getDoc29, setDoc as setDoc24, updateDoc as updateDoc26, deleteDoc as deleteDoc17 } from "firebase/firestore";
13192
+ var CalendarServiceV3 = class extends BaseService {
13193
+ /**
13194
+ * Creates a new CalendarServiceV3 instance
13195
+ * @param db - Firestore instance
13196
+ * @param auth - Firebase Auth instance
13197
+ * @param app - Firebase App instance
13198
+ */
13199
+ constructor(db, auth, app) {
13200
+ super(db, auth, app);
13201
+ }
13202
+ // #region Blocking Event CRUD Operations
13203
+ /**
13204
+ * Creates a blocking event for a practitioner or clinic
13205
+ * @param params - Blocking event creation parameters
13206
+ * @returns Created calendar event
13207
+ */
13208
+ async createBlockingEvent(params) {
13209
+ this.validateBlockingEventParams(params);
13210
+ const eventId = this.generateId();
13211
+ const collectionPath = this.getEntityCalendarPath(
13212
+ params.entityType,
13213
+ params.entityId
13214
+ );
13215
+ const eventRef = doc27(this.db, collectionPath, eventId);
13216
+ const eventData = {
13217
+ id: eventId,
13218
+ eventName: params.eventName,
13219
+ eventTime: params.eventTime,
13220
+ eventType: params.eventType,
13221
+ description: params.description || "",
13222
+ status: "confirmed" /* CONFIRMED */,
13223
+ // Blocking events are always confirmed
13224
+ syncStatus: "internal" /* INTERNAL */,
13225
+ createdAt: serverTimestamp23(),
13226
+ updatedAt: serverTimestamp23()
13227
+ };
13228
+ if (params.entityType === "practitioner") {
13229
+ eventData.practitionerProfileId = params.entityId;
13230
+ } else {
13231
+ eventData.clinicBranchId = params.entityId;
13232
+ }
13233
+ await setDoc24(eventRef, eventData);
13234
+ return {
13235
+ ...eventData,
13236
+ createdAt: Timestamp29.now(),
13237
+ updatedAt: Timestamp29.now()
13238
+ };
13239
+ }
13240
+ /**
13241
+ * Updates a blocking event
13242
+ * @param params - Blocking event update parameters
13243
+ * @returns Updated calendar event
13244
+ */
13245
+ async updateBlockingEvent(params) {
13246
+ const collectionPath = this.getEntityCalendarPath(
13247
+ params.entityType,
13248
+ params.entityId
13249
+ );
13250
+ const eventRef = doc27(this.db, collectionPath, params.eventId);
13251
+ const eventDoc = await getDoc29(eventRef);
13252
+ if (!eventDoc.exists()) {
13253
+ throw new Error(`Blocking event with ID ${params.eventId} not found`);
13254
+ }
13255
+ const updateData = {
13256
+ updatedAt: serverTimestamp23()
13257
+ };
13258
+ if (params.eventName !== void 0) {
13259
+ updateData.eventName = params.eventName;
13260
+ }
13261
+ if (params.eventTime !== void 0) {
13262
+ updateData.eventTime = params.eventTime;
13263
+ }
13264
+ if (params.description !== void 0) {
13265
+ updateData.description = params.description;
13266
+ }
13267
+ if (params.status !== void 0) {
13268
+ updateData.status = params.status;
13269
+ }
13270
+ await updateDoc26(eventRef, updateData);
13271
+ const updatedEventDoc = await getDoc29(eventRef);
13272
+ return updatedEventDoc.data();
13273
+ }
13274
+ /**
13275
+ * Deletes a blocking event
13276
+ * @param entityType - Type of entity (practitioner or clinic)
13277
+ * @param entityId - ID of the entity
13278
+ * @param eventId - ID of the event to delete
13279
+ */
13280
+ async deleteBlockingEvent(entityType, entityId, eventId) {
13281
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
13282
+ const eventRef = doc27(this.db, collectionPath, eventId);
13283
+ const eventDoc = await getDoc29(eventRef);
13284
+ if (!eventDoc.exists()) {
13285
+ throw new Error(`Blocking event with ID ${eventId} not found`);
13286
+ }
13287
+ await deleteDoc17(eventRef);
13288
+ }
13289
+ /**
13290
+ * Gets a specific blocking event
13291
+ * @param entityType - Type of entity (practitioner or clinic)
13292
+ * @param entityId - ID of the entity
13293
+ * @param eventId - ID of the event to retrieve
13294
+ * @returns Calendar event or null if not found
13295
+ */
13296
+ async getBlockingEvent(entityType, entityId, eventId) {
13297
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
13298
+ const eventRef = doc27(this.db, collectionPath, eventId);
13299
+ const eventDoc = await getDoc29(eventRef);
13300
+ if (!eventDoc.exists()) {
13301
+ return null;
13302
+ }
13303
+ return eventDoc.data();
13304
+ }
13305
+ /**
13306
+ * Gets blocking events for a specific entity
13307
+ * @param entityType - Type of entity (practitioner or clinic)
13308
+ * @param entityId - ID of the entity
13309
+ * @param dateRange - Optional date range filter
13310
+ * @param eventType - Optional event type filter
13311
+ * @returns Array of calendar events
13312
+ */
13313
+ async getEntityBlockingEvents(entityType, entityId, dateRange, eventType) {
13314
+ const searchParams = {
13315
+ searchLocation: entityType === "practitioner" ? "practitioner" /* PRACTITIONER */ : "clinic" /* CLINIC */,
13316
+ entityId,
13317
+ dateRange,
13318
+ eventType
13319
+ };
13320
+ if (!eventType) {
13321
+ const allEvents = await searchCalendarEventsUtil(this.db, searchParams);
13322
+ return allEvents.filter(
13323
+ (event) => event.eventType === "blocking" /* BLOCKING */ || event.eventType === "break" /* BREAK */ || event.eventType === "free_day" /* FREE_DAY */ || event.eventType === "other" /* OTHER */
13324
+ );
13325
+ }
13326
+ return searchCalendarEventsUtil(this.db, searchParams);
13327
+ }
13328
+ // #endregion
13329
+ // #region Calendar Event Search
13330
+ /**
13331
+ * Searches for calendar events based on specified criteria.
13332
+ * This method supports searching for ALL event types (appointments, blocking events, etc.)
13333
+ *
13334
+ * @param params - The search parameters
13335
+ * @returns A promise that resolves to an array of matching calendar events
13336
+ */
13337
+ async searchCalendarEvents(params) {
13338
+ return searchCalendarEventsUtil(this.db, params);
13339
+ }
13340
+ // #endregion
13341
+ // #region Private Helper Methods
13342
+ /**
13343
+ * Gets the calendar collection path for a specific entity
13344
+ * @param entityType - Type of entity (practitioner or clinic)
13345
+ * @param entityId - ID of the entity
13346
+ * @returns Collection path string
13347
+ */
13348
+ getEntityCalendarPath(entityType, entityId) {
13349
+ if (entityType === "practitioner") {
13350
+ return `${PRACTITIONERS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
13351
+ } else {
13352
+ return `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
13353
+ }
13354
+ }
13355
+ /**
13356
+ * Validates blocking event creation parameters
13357
+ * @param params - Parameters to validate
13358
+ * @throws Error if validation fails
13359
+ */
13360
+ validateBlockingEventParams(params) {
13361
+ if (!params.entityType || !params.entityId) {
13362
+ throw new Error("Entity type and ID are required");
13363
+ }
13364
+ if (!params.eventName || params.eventName.trim() === "") {
13365
+ throw new Error("Event name is required");
13366
+ }
13367
+ if (!params.eventTime || !params.eventTime.start || !params.eventTime.end) {
13368
+ throw new Error("Event time with start and end is required");
13369
+ }
13370
+ if (params.eventTime.end.toMillis() <= params.eventTime.start.toMillis()) {
13371
+ throw new Error("Event end time must be after start time");
13372
+ }
13373
+ const validTypes = [
13374
+ "blocking" /* BLOCKING */,
13375
+ "break" /* BREAK */,
13376
+ "free_day" /* FREE_DAY */,
13377
+ "other" /* OTHER */
13378
+ ];
13379
+ if (!validTypes.includes(params.eventType)) {
13380
+ throw new Error("Invalid event type for blocking events");
13381
+ }
13382
+ }
13383
+ // #endregion
13384
+ };
13385
+
13167
13386
  // src/services/reviews/reviews.service.ts
13168
13387
  import {
13169
13388
  collection as collection26,
13170
- doc as doc27,
13171
- getDoc as getDoc29,
13389
+ doc as doc28,
13390
+ getDoc as getDoc30,
13172
13391
  getDocs as getDocs26,
13173
13392
  query as query26,
13174
13393
  where as where26,
13175
- setDoc as setDoc24,
13176
- deleteDoc as deleteDoc17,
13177
- serverTimestamp as serverTimestamp23
13394
+ setDoc as setDoc25,
13395
+ deleteDoc as deleteDoc18,
13396
+ serverTimestamp as serverTimestamp24
13178
13397
  } from "firebase/firestore";
13179
13398
 
13180
13399
  // src/types/reviews/index.ts
@@ -13260,11 +13479,11 @@ var ReviewService = class extends BaseService {
13260
13479
  updatedAt: now
13261
13480
  };
13262
13481
  reviewSchema.parse(review);
13263
- const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13264
- await setDoc24(docRef, {
13482
+ const docRef = doc28(this.db, REVIEWS_COLLECTION, reviewId);
13483
+ await setDoc25(docRef, {
13265
13484
  ...review,
13266
- createdAt: serverTimestamp23(),
13267
- updatedAt: serverTimestamp23()
13485
+ createdAt: serverTimestamp24(),
13486
+ updatedAt: serverTimestamp24()
13268
13487
  });
13269
13488
  return review;
13270
13489
  } catch (error) {
@@ -13280,8 +13499,8 @@ var ReviewService = class extends BaseService {
13280
13499
  * @returns The review if found, null otherwise
13281
13500
  */
13282
13501
  async getReview(reviewId) {
13283
- const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13284
- const docSnap = await getDoc29(docRef);
13502
+ const docRef = doc28(this.db, REVIEWS_COLLECTION, reviewId);
13503
+ const docSnap = await getDoc30(docRef);
13285
13504
  if (!docSnap.exists()) {
13286
13505
  return null;
13287
13506
  }
@@ -13298,7 +13517,7 @@ var ReviewService = class extends BaseService {
13298
13517
  where26("patientId", "==", patientId)
13299
13518
  );
13300
13519
  const snapshot = await getDocs26(q);
13301
- return snapshot.docs.map((doc35) => doc35.data());
13520
+ return snapshot.docs.map((doc36) => doc36.data());
13302
13521
  }
13303
13522
  /**
13304
13523
  * Gets all reviews for a specific clinic
@@ -13311,7 +13530,7 @@ var ReviewService = class extends BaseService {
13311
13530
  where26("clinicReview.clinicId", "==", clinicId)
13312
13531
  );
13313
13532
  const snapshot = await getDocs26(q);
13314
- return snapshot.docs.map((doc35) => doc35.data());
13533
+ return snapshot.docs.map((doc36) => doc36.data());
13315
13534
  }
13316
13535
  /**
13317
13536
  * Gets all reviews for a specific practitioner
@@ -13324,7 +13543,7 @@ var ReviewService = class extends BaseService {
13324
13543
  where26("practitionerReview.practitionerId", "==", practitionerId)
13325
13544
  );
13326
13545
  const snapshot = await getDocs26(q);
13327
- return snapshot.docs.map((doc35) => doc35.data());
13546
+ return snapshot.docs.map((doc36) => doc36.data());
13328
13547
  }
13329
13548
  /**
13330
13549
  * Gets all reviews for a specific procedure
@@ -13337,7 +13556,7 @@ var ReviewService = class extends BaseService {
13337
13556
  where26("procedureReview.procedureId", "==", procedureId)
13338
13557
  );
13339
13558
  const snapshot = await getDocs26(q);
13340
- return snapshot.docs.map((doc35) => doc35.data());
13559
+ return snapshot.docs.map((doc36) => doc36.data());
13341
13560
  }
13342
13561
  /**
13343
13562
  * Gets all reviews for a specific appointment
@@ -13364,7 +13583,7 @@ var ReviewService = class extends BaseService {
13364
13583
  if (!review) {
13365
13584
  throw new Error(`Review with ID ${reviewId} not found`);
13366
13585
  }
13367
- await deleteDoc17(doc27(this.db, REVIEWS_COLLECTION, reviewId));
13586
+ await deleteDoc18(doc28(this.db, REVIEWS_COLLECTION, reviewId));
13368
13587
  }
13369
13588
  /**
13370
13589
  * Calculates the average of an array of numbers
@@ -13383,8 +13602,8 @@ var ReviewService = class extends BaseService {
13383
13602
 
13384
13603
  // src/services/appointment/appointment.service.ts
13385
13604
  import {
13386
- Timestamp as Timestamp30,
13387
- serverTimestamp as serverTimestamp25,
13605
+ Timestamp as Timestamp31,
13606
+ serverTimestamp as serverTimestamp26,
13388
13607
  arrayUnion as arrayUnion8,
13389
13608
  arrayRemove as arrayRemove7,
13390
13609
  where as where28,
@@ -13400,15 +13619,15 @@ import { getFunctions as getFunctions2 } from "firebase/functions";
13400
13619
  // src/services/appointment/utils/appointment.utils.ts
13401
13620
  import {
13402
13621
  collection as collection27,
13403
- doc as doc28,
13404
- getDoc as getDoc30,
13622
+ doc as doc29,
13623
+ getDoc as getDoc31,
13405
13624
  getDocs as getDocs27,
13406
13625
  query as query27,
13407
13626
  where as where27,
13408
- setDoc as setDoc25,
13409
- updateDoc as updateDoc26,
13410
- serverTimestamp as serverTimestamp24,
13411
- Timestamp as Timestamp29,
13627
+ setDoc as setDoc26,
13628
+ updateDoc as updateDoc27,
13629
+ serverTimestamp as serverTimestamp25,
13630
+ Timestamp as Timestamp30,
13412
13631
  orderBy as orderBy14,
13413
13632
  limit as limit12,
13414
13633
  startAfter as startAfter10
@@ -13420,8 +13639,8 @@ var TECHNOLOGIES_COLLECTION = "technologies";
13420
13639
  // src/services/appointment/utils/appointment.utils.ts
13421
13640
  async function updateAppointmentUtil2(db, appointmentId, data) {
13422
13641
  try {
13423
- const appointmentRef = doc28(db, APPOINTMENTS_COLLECTION, appointmentId);
13424
- const appointmentDoc = await getDoc30(appointmentRef);
13642
+ const appointmentRef = doc29(db, APPOINTMENTS_COLLECTION, appointmentId);
13643
+ const appointmentDoc = await getDoc31(appointmentRef);
13425
13644
  if (!appointmentDoc.exists()) {
13426
13645
  throw new Error(`Appointment with ID ${appointmentId} not found`);
13427
13646
  }
@@ -13470,7 +13689,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13470
13689
  ...data,
13471
13690
  completedPreRequirements,
13472
13691
  completedPostRequirements,
13473
- updatedAt: serverTimestamp24()
13692
+ updatedAt: serverTimestamp25()
13474
13693
  };
13475
13694
  Object.keys(updateData).forEach((key) => {
13476
13695
  if (updateData[key] === void 0) {
@@ -13479,7 +13698,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13479
13698
  });
13480
13699
  if (data.status && data.status !== currentAppointment.status) {
13481
13700
  if (data.status === "confirmed" /* CONFIRMED */ && !updateData.confirmationTime) {
13482
- updateData.confirmationTime = Timestamp29.now();
13701
+ updateData.confirmationTime = Timestamp30.now();
13483
13702
  }
13484
13703
  if (currentAppointment.calendarEventId) {
13485
13704
  await updateCalendarEventStatus(
@@ -13489,8 +13708,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13489
13708
  );
13490
13709
  }
13491
13710
  }
13492
- await updateDoc26(appointmentRef, updateData);
13493
- const updatedAppointmentDoc = await getDoc30(appointmentRef);
13711
+ await updateDoc27(appointmentRef, updateData);
13712
+ const updatedAppointmentDoc = await getDoc31(appointmentRef);
13494
13713
  if (!updatedAppointmentDoc.exists()) {
13495
13714
  throw new Error(
13496
13715
  `Failed to retrieve updated appointment ${appointmentId}`
@@ -13504,8 +13723,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13504
13723
  }
13505
13724
  async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus) {
13506
13725
  try {
13507
- const calendarEventRef = doc28(db, CALENDAR_COLLECTION, calendarEventId);
13508
- const calendarEventDoc = await getDoc30(calendarEventRef);
13726
+ const calendarEventRef = doc29(db, CALENDAR_COLLECTION, calendarEventId);
13727
+ const calendarEventDoc = await getDoc31(calendarEventRef);
13509
13728
  if (!calendarEventDoc.exists()) {
13510
13729
  console.warn(`Calendar event with ID ${calendarEventId} not found`);
13511
13730
  return;
@@ -13528,9 +13747,9 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13528
13747
  default:
13529
13748
  return;
13530
13749
  }
13531
- await updateDoc26(calendarEventRef, {
13750
+ await updateDoc27(calendarEventRef, {
13532
13751
  status: calendarStatus,
13533
- updatedAt: serverTimestamp24()
13752
+ updatedAt: serverTimestamp25()
13534
13753
  });
13535
13754
  } catch (error) {
13536
13755
  console.error(`Error updating calendar event ${calendarEventId}:`, error);
@@ -13538,8 +13757,8 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13538
13757
  }
13539
13758
  async function getAppointmentByIdUtil(db, appointmentId) {
13540
13759
  try {
13541
- const appointmentDoc = await getDoc30(
13542
- doc28(db, APPOINTMENTS_COLLECTION, appointmentId)
13760
+ const appointmentDoc = await getDoc31(
13761
+ doc29(db, APPOINTMENTS_COLLECTION, appointmentId)
13543
13762
  );
13544
13763
  if (!appointmentDoc.exists()) {
13545
13764
  return null;
@@ -13567,13 +13786,13 @@ async function searchAppointmentsUtil(db, params) {
13567
13786
  where27(
13568
13787
  "appointmentStartTime",
13569
13788
  ">=",
13570
- Timestamp29.fromDate(params.startDate)
13789
+ Timestamp30.fromDate(params.startDate)
13571
13790
  )
13572
13791
  );
13573
13792
  }
13574
13793
  if (params.endDate) {
13575
13794
  constraints.push(
13576
- where27("appointmentStartTime", "<=", Timestamp29.fromDate(params.endDate))
13795
+ where27("appointmentStartTime", "<=", Timestamp30.fromDate(params.endDate))
13577
13796
  );
13578
13797
  }
13579
13798
  if (params.status) {
@@ -13593,7 +13812,7 @@ async function searchAppointmentsUtil(db, params) {
13593
13812
  const q = query27(collection27(db, APPOINTMENTS_COLLECTION), ...constraints);
13594
13813
  const querySnapshot = await getDocs27(q);
13595
13814
  const appointments = querySnapshot.docs.map(
13596
- (doc35) => doc35.data()
13815
+ (doc36) => doc36.data()
13597
13816
  );
13598
13817
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
13599
13818
  return { appointments, lastDoc };
@@ -13962,7 +14181,7 @@ var AppointmentService = class extends BaseService {
13962
14181
  );
13963
14182
  const updateData = {
13964
14183
  status: newStatus,
13965
- updatedAt: serverTimestamp25()
14184
+ updatedAt: serverTimestamp26()
13966
14185
  };
13967
14186
  if (newStatus === "canceled_clinic" /* CANCELED_CLINIC */ || newStatus === "canceled_patient" /* CANCELED_PATIENT */ || newStatus === "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */) {
13968
14187
  if (!(details == null ? void 0 : details.cancellationReason)) {
@@ -13973,13 +14192,13 @@ var AppointmentService = class extends BaseService {
13973
14192
  }
13974
14193
  updateData.cancellationReason = details.cancellationReason;
13975
14194
  updateData.canceledBy = details.canceledBy;
13976
- updateData.cancellationTime = Timestamp30.now();
14195
+ updateData.cancellationTime = Timestamp31.now();
13977
14196
  }
13978
14197
  if (newStatus === "confirmed" /* CONFIRMED */) {
13979
- updateData.confirmationTime = Timestamp30.now();
14198
+ updateData.confirmationTime = Timestamp31.now();
13980
14199
  }
13981
14200
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
13982
- updateData.rescheduleTime = Timestamp30.now();
14201
+ updateData.rescheduleTime = Timestamp31.now();
13983
14202
  }
13984
14203
  return this.updateAppointment(appointmentId, updateData);
13985
14204
  }
@@ -14057,9 +14276,9 @@ var AppointmentService = class extends BaseService {
14057
14276
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
14058
14277
  appointmentStartTime: startTimestamp,
14059
14278
  appointmentEndTime: endTimestamp,
14060
- rescheduleTime: Timestamp30.now(),
14279
+ rescheduleTime: Timestamp31.now(),
14061
14280
  confirmationTime: null,
14062
- updatedAt: serverTimestamp25()
14281
+ updatedAt: serverTimestamp26()
14063
14282
  };
14064
14283
  return this.updateAppointment(validatedParams.appointmentId, updateData);
14065
14284
  }
@@ -14077,19 +14296,19 @@ var AppointmentService = class extends BaseService {
14077
14296
  return value;
14078
14297
  }
14079
14298
  if (typeof value === "number") {
14080
- return Timestamp30.fromMillis(value);
14299
+ return Timestamp31.fromMillis(value);
14081
14300
  }
14082
14301
  if (typeof value === "string") {
14083
- return Timestamp30.fromDate(new Date(value));
14302
+ return Timestamp31.fromDate(new Date(value));
14084
14303
  }
14085
14304
  if (value instanceof Date) {
14086
- return Timestamp30.fromDate(value);
14305
+ return Timestamp31.fromDate(value);
14087
14306
  }
14088
14307
  if (value && typeof value._seconds === "number") {
14089
- return new Timestamp30(value._seconds, value._nanoseconds || 0);
14308
+ return new Timestamp31(value._seconds, value._nanoseconds || 0);
14090
14309
  }
14091
14310
  if (value && typeof value.seconds === "number") {
14092
- return new Timestamp30(value.seconds, value.nanoseconds || 0);
14311
+ return new Timestamp31(value.seconds, value.nanoseconds || 0);
14093
14312
  }
14094
14313
  throw new Error(
14095
14314
  `Invalid timestamp format: ${typeof value}, value: ${JSON.stringify(
@@ -14188,9 +14407,9 @@ var AppointmentService = class extends BaseService {
14188
14407
  }
14189
14408
  const updateData = {
14190
14409
  status: "in_progress" /* IN_PROGRESS */,
14191
- procedureActualStartTime: Timestamp30.now(),
14410
+ procedureActualStartTime: Timestamp31.now(),
14192
14411
  // Set actual start time
14193
- updatedAt: serverTimestamp25()
14412
+ updatedAt: serverTimestamp26()
14194
14413
  };
14195
14414
  return this.updateAppointment(appointmentId, updateData);
14196
14415
  }
@@ -14208,7 +14427,7 @@ var AppointmentService = class extends BaseService {
14208
14427
  if (!appointment)
14209
14428
  throw new Error(`Appointment ${appointmentId} not found.`);
14210
14429
  let calculatedDurationMinutes = actualDurationMinutesInput;
14211
- const procedureCompletionTime = Timestamp30.now();
14430
+ const procedureCompletionTime = Timestamp31.now();
14212
14431
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
14213
14432
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
14214
14433
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -14231,7 +14450,7 @@ var AppointmentService = class extends BaseService {
14231
14450
  },
14232
14451
  // Optionally update appointmentEndTime to the actual completion time
14233
14452
  // appointmentEndTime: procedureCompletionTime,
14234
- updatedAt: serverTimestamp25()
14453
+ updatedAt: serverTimestamp26()
14235
14454
  };
14236
14455
  return this.updateAppointment(appointmentId, updateData);
14237
14456
  }
@@ -14245,7 +14464,7 @@ var AppointmentService = class extends BaseService {
14245
14464
  const appointment = await this.getAppointmentById(appointmentId);
14246
14465
  if (!appointment)
14247
14466
  throw new Error(`Appointment ${appointmentId} not found.`);
14248
- if (Timestamp30.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
14467
+ if (Timestamp31.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
14249
14468
  throw new Error("Cannot mark no-show before appointment start time.");
14250
14469
  }
14251
14470
  return this.updateAppointmentStatus(
@@ -14269,12 +14488,12 @@ var AppointmentService = class extends BaseService {
14269
14488
  const newMediaItem = {
14270
14489
  ...mediaItemData,
14271
14490
  id: this.generateId(),
14272
- uploadedAt: Timestamp30.now(),
14491
+ uploadedAt: Timestamp31.now(),
14273
14492
  uploadedBy: currentUser.uid
14274
14493
  };
14275
14494
  const updateData = {
14276
14495
  media: arrayUnion8(newMediaItem),
14277
- updatedAt: serverTimestamp25()
14496
+ updatedAt: serverTimestamp26()
14278
14497
  };
14279
14498
  return this.updateAppointment(appointmentId, updateData);
14280
14499
  }
@@ -14295,7 +14514,7 @@ var AppointmentService = class extends BaseService {
14295
14514
  }
14296
14515
  const updateData = {
14297
14516
  media: arrayRemove7(mediaToRemove),
14298
- updatedAt: serverTimestamp25()
14517
+ updatedAt: serverTimestamp26()
14299
14518
  };
14300
14519
  return this.updateAppointment(appointmentId, updateData);
14301
14520
  }
@@ -14309,11 +14528,11 @@ var AppointmentService = class extends BaseService {
14309
14528
  const newReviewInfo = {
14310
14529
  ...reviewData,
14311
14530
  reviewId: this.generateId(),
14312
- reviewedAt: Timestamp30.now()
14531
+ reviewedAt: Timestamp31.now()
14313
14532
  };
14314
14533
  const updateData = {
14315
14534
  reviewInfo: newReviewInfo,
14316
- updatedAt: serverTimestamp25()
14535
+ updatedAt: serverTimestamp26()
14317
14536
  };
14318
14537
  return this.updateAppointment(appointmentId, updateData);
14319
14538
  }
@@ -14327,7 +14546,7 @@ var AppointmentService = class extends BaseService {
14327
14546
  const updateData = {
14328
14547
  paymentStatus,
14329
14548
  paymentTransactionId: paymentTransactionId || null,
14330
- updatedAt: serverTimestamp25()
14549
+ updatedAt: serverTimestamp26()
14331
14550
  };
14332
14551
  return this.updateAppointment(appointmentId, updateData);
14333
14552
  }
@@ -14375,7 +14594,7 @@ var AppointmentService = class extends BaseService {
14375
14594
  where28(
14376
14595
  "appointmentStartTime",
14377
14596
  ">=",
14378
- Timestamp30.fromDate(effectiveStartDate)
14597
+ Timestamp31.fromDate(effectiveStartDate)
14379
14598
  )
14380
14599
  );
14381
14600
  if (options == null ? void 0 : options.endDate) {
@@ -14383,7 +14602,7 @@ var AppointmentService = class extends BaseService {
14383
14602
  where28(
14384
14603
  "appointmentStartTime",
14385
14604
  "<=",
14386
- Timestamp30.fromDate(options.endDate)
14605
+ Timestamp31.fromDate(options.endDate)
14387
14606
  )
14388
14607
  );
14389
14608
  }
@@ -14400,7 +14619,7 @@ var AppointmentService = class extends BaseService {
14400
14619
  );
14401
14620
  const querySnapshot = await getDocs28(q);
14402
14621
  const appointments = querySnapshot.docs.map(
14403
- (doc35) => doc35.data()
14622
+ (doc36) => doc36.data()
14404
14623
  );
14405
14624
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
14406
14625
  console.log(
@@ -14449,7 +14668,7 @@ var AppointmentService = class extends BaseService {
14449
14668
  where28(
14450
14669
  "appointmentStartTime",
14451
14670
  ">=",
14452
- Timestamp30.fromDate(options.startDate)
14671
+ Timestamp31.fromDate(options.startDate)
14453
14672
  )
14454
14673
  );
14455
14674
  }
@@ -14457,7 +14676,7 @@ var AppointmentService = class extends BaseService {
14457
14676
  where28(
14458
14677
  "appointmentStartTime",
14459
14678
  "<=",
14460
- Timestamp30.fromDate(effectiveEndDate)
14679
+ Timestamp31.fromDate(effectiveEndDate)
14461
14680
  )
14462
14681
  );
14463
14682
  constraints.push(orderBy15("appointmentStartTime", "desc"));
@@ -14473,7 +14692,7 @@ var AppointmentService = class extends BaseService {
14473
14692
  );
14474
14693
  const querySnapshot = await getDocs28(q);
14475
14694
  const appointments = querySnapshot.docs.map(
14476
- (doc35) => doc35.data()
14695
+ (doc36) => doc36.data()
14477
14696
  );
14478
14697
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
14479
14698
  console.log(
@@ -14496,13 +14715,13 @@ import {
14496
14715
  getDocs as getDocs29,
14497
14716
  query as query29,
14498
14717
  where as where29,
14499
- doc as doc29,
14500
- updateDoc as updateDoc27,
14501
- Timestamp as Timestamp31,
14718
+ doc as doc30,
14719
+ updateDoc as updateDoc28,
14720
+ Timestamp as Timestamp32,
14502
14721
  orderBy as orderBy16,
14503
14722
  limit as limit14,
14504
14723
  startAfter as startAfter12,
14505
- getDoc as getDoc31
14724
+ getDoc as getDoc32
14506
14725
  } from "firebase/firestore";
14507
14726
 
14508
14727
  // src/types/patient/patient-requirements.ts
@@ -14539,7 +14758,7 @@ var PatientRequirementsService = class extends BaseService {
14539
14758
  );
14540
14759
  }
14541
14760
  getPatientRequirementDocRef(patientId, instanceId) {
14542
- return doc29(
14761
+ return doc30(
14543
14762
  this.getPatientRequirementsCollectionRef(patientId),
14544
14763
  instanceId
14545
14764
  );
@@ -14552,7 +14771,7 @@ var PatientRequirementsService = class extends BaseService {
14552
14771
  */
14553
14772
  async getPatientRequirementInstance(patientId, instanceId) {
14554
14773
  const docRef = this.getPatientRequirementDocRef(patientId, instanceId);
14555
- const docSnap = await getDoc31(docRef);
14774
+ const docSnap = await getDoc32(docRef);
14556
14775
  if (!docSnap.exists()) {
14557
14776
  return null;
14558
14777
  }
@@ -14629,7 +14848,7 @@ var PatientRequirementsService = class extends BaseService {
14629
14848
  */
14630
14849
  async completeInstruction(patientId, instanceId, instructionId) {
14631
14850
  const instanceRef = this.getPatientRequirementDocRef(patientId, instanceId);
14632
- const instanceSnap = await getDoc31(instanceRef);
14851
+ const instanceSnap = await getDoc32(instanceRef);
14633
14852
  if (!instanceSnap.exists()) {
14634
14853
  throw new Error(
14635
14854
  `PatientRequirementInstance ${instanceId} not found for patient ${patientId}.`
@@ -14657,7 +14876,7 @@ var PatientRequirementsService = class extends BaseService {
14657
14876
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
14658
14877
  );
14659
14878
  }
14660
- const now = Timestamp31.now();
14879
+ const now = Timestamp32.now();
14661
14880
  const updatedInstructions = [...instance.instructions];
14662
14881
  updatedInstructions[instructionIndex] = {
14663
14882
  ...instructionToUpdate,
@@ -14684,7 +14903,7 @@ var PatientRequirementsService = class extends BaseService {
14684
14903
  if (newOverallStatus !== instance.overallStatus) {
14685
14904
  updatePayload.overallStatus = newOverallStatus;
14686
14905
  }
14687
- await updateDoc27(instanceRef, updatePayload);
14906
+ await updateDoc28(instanceRef, updatePayload);
14688
14907
  return {
14689
14908
  ...instance,
14690
14909
  instructions: updatedInstructions,
@@ -14700,11 +14919,11 @@ var PatientRequirementsService = class extends BaseService {
14700
14919
  import {
14701
14920
  addDoc as addDoc3,
14702
14921
  collection as collection30,
14703
- doc as doc30,
14704
- getDoc as getDoc32,
14922
+ doc as doc31,
14923
+ getDoc as getDoc33,
14705
14924
  getDocs as getDocs30,
14706
14925
  query as query30,
14707
- updateDoc as updateDoc28,
14926
+ updateDoc as updateDoc29,
14708
14927
  where as where30
14709
14928
  } from "firebase/firestore";
14710
14929
 
@@ -14740,9 +14959,9 @@ var BrandService = class extends BaseService {
14740
14959
  const q = query30(this.getBrandsRef(), where30("isActive", "==", true));
14741
14960
  const snapshot = await getDocs30(q);
14742
14961
  return snapshot.docs.map(
14743
- (doc35) => ({
14744
- id: doc35.id,
14745
- ...doc35.data()
14962
+ (doc36) => ({
14963
+ id: doc36.id,
14964
+ ...doc36.data()
14746
14965
  })
14747
14966
  );
14748
14967
  }
@@ -14754,8 +14973,8 @@ var BrandService = class extends BaseService {
14754
14973
  ...brand,
14755
14974
  updatedAt: /* @__PURE__ */ new Date()
14756
14975
  };
14757
- const docRef = doc30(this.getBrandsRef(), brandId);
14758
- await updateDoc28(docRef, updateData);
14976
+ const docRef = doc31(this.getBrandsRef(), brandId);
14977
+ await updateDoc29(docRef, updateData);
14759
14978
  return this.getById(brandId);
14760
14979
  }
14761
14980
  /**
@@ -14770,8 +14989,8 @@ var BrandService = class extends BaseService {
14770
14989
  * Gets a brand by ID
14771
14990
  */
14772
14991
  async getById(brandId) {
14773
- const docRef = doc30(this.getBrandsRef(), brandId);
14774
- const docSnap = await getDoc32(docRef);
14992
+ const docRef = doc31(this.getBrandsRef(), brandId);
14993
+ const docSnap = await getDoc33(docRef);
14775
14994
  if (!docSnap.exists()) return null;
14776
14995
  return {
14777
14996
  id: docSnap.id,
@@ -14784,11 +15003,11 @@ var BrandService = class extends BaseService {
14784
15003
  import {
14785
15004
  addDoc as addDoc4,
14786
15005
  collection as collection31,
14787
- doc as doc31,
14788
- getDoc as getDoc33,
15006
+ doc as doc32,
15007
+ getDoc as getDoc34,
14789
15008
  getDocs as getDocs31,
14790
15009
  query as query31,
14791
- updateDoc as updateDoc29,
15010
+ updateDoc as updateDoc30,
14792
15011
  where as where31
14793
15012
  } from "firebase/firestore";
14794
15013
 
@@ -14827,9 +15046,9 @@ var CategoryService = class extends BaseService {
14827
15046
  const q = query31(this.categoriesRef, where31("isActive", "==", true));
14828
15047
  const snapshot = await getDocs31(q);
14829
15048
  return snapshot.docs.map(
14830
- (doc35) => ({
14831
- id: doc35.id,
14832
- ...doc35.data()
15049
+ (doc36) => ({
15050
+ id: doc36.id,
15051
+ ...doc36.data()
14833
15052
  })
14834
15053
  );
14835
15054
  }
@@ -14846,9 +15065,9 @@ var CategoryService = class extends BaseService {
14846
15065
  );
14847
15066
  const snapshot = await getDocs31(q);
14848
15067
  return snapshot.docs.map(
14849
- (doc35) => ({
14850
- id: doc35.id,
14851
- ...doc35.data()
15068
+ (doc36) => ({
15069
+ id: doc36.id,
15070
+ ...doc36.data()
14852
15071
  })
14853
15072
  );
14854
15073
  }
@@ -14863,8 +15082,8 @@ var CategoryService = class extends BaseService {
14863
15082
  ...category,
14864
15083
  updatedAt: /* @__PURE__ */ new Date()
14865
15084
  };
14866
- const docRef = doc31(this.categoriesRef, id);
14867
- await updateDoc29(docRef, updateData);
15085
+ const docRef = doc32(this.categoriesRef, id);
15086
+ await updateDoc30(docRef, updateData);
14868
15087
  return this.getById(id);
14869
15088
  }
14870
15089
  /**
@@ -14880,8 +15099,8 @@ var CategoryService = class extends BaseService {
14880
15099
  * @returns Kategorija ili null ako ne postoji
14881
15100
  */
14882
15101
  async getById(id) {
14883
- const docRef = doc31(this.categoriesRef, id);
14884
- const docSnap = await getDoc33(docRef);
15102
+ const docRef = doc32(this.categoriesRef, id);
15103
+ const docSnap = await getDoc34(docRef);
14885
15104
  if (!docSnap.exists()) return null;
14886
15105
  return {
14887
15106
  id: docSnap.id,
@@ -14894,11 +15113,11 @@ var CategoryService = class extends BaseService {
14894
15113
  import {
14895
15114
  addDoc as addDoc5,
14896
15115
  collection as collection32,
14897
- doc as doc32,
14898
- getDoc as getDoc34,
15116
+ doc as doc33,
15117
+ getDoc as getDoc35,
14899
15118
  getDocs as getDocs32,
14900
15119
  query as query32,
14901
- updateDoc as updateDoc30,
15120
+ updateDoc as updateDoc31,
14902
15121
  where as where32
14903
15122
  } from "firebase/firestore";
14904
15123
 
@@ -14952,9 +15171,9 @@ var SubcategoryService = class extends BaseService {
14952
15171
  );
14953
15172
  const snapshot = await getDocs32(q);
14954
15173
  return snapshot.docs.map(
14955
- (doc35) => ({
14956
- id: doc35.id,
14957
- ...doc35.data()
15174
+ (doc36) => ({
15175
+ id: doc36.id,
15176
+ ...doc36.data()
14958
15177
  })
14959
15178
  );
14960
15179
  }
@@ -14970,8 +15189,8 @@ var SubcategoryService = class extends BaseService {
14970
15189
  ...subcategory,
14971
15190
  updatedAt: /* @__PURE__ */ new Date()
14972
15191
  };
14973
- const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14974
- await updateDoc30(docRef, updateData);
15192
+ const docRef = doc33(this.getSubcategoriesRef(categoryId), subcategoryId);
15193
+ await updateDoc31(docRef, updateData);
14975
15194
  return this.getById(categoryId, subcategoryId);
14976
15195
  }
14977
15196
  /**
@@ -14989,8 +15208,8 @@ var SubcategoryService = class extends BaseService {
14989
15208
  * @returns Podkategorija ili null ako ne postoji
14990
15209
  */
14991
15210
  async getById(categoryId, subcategoryId) {
14992
- const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14993
- const docSnap = await getDoc34(docRef);
15211
+ const docRef = doc33(this.getSubcategoriesRef(categoryId), subcategoryId);
15212
+ const docSnap = await getDoc35(docRef);
14994
15213
  if (!docSnap.exists()) return null;
14995
15214
  return {
14996
15215
  id: docSnap.id,
@@ -15003,11 +15222,11 @@ var SubcategoryService = class extends BaseService {
15003
15222
  import {
15004
15223
  addDoc as addDoc6,
15005
15224
  collection as collection33,
15006
- doc as doc33,
15007
- getDoc as getDoc35,
15225
+ doc as doc34,
15226
+ getDoc as getDoc36,
15008
15227
  getDocs as getDocs33,
15009
15228
  query as query33,
15010
- updateDoc as updateDoc31,
15229
+ updateDoc as updateDoc32,
15011
15230
  where as where33,
15012
15231
  arrayUnion as arrayUnion9,
15013
15232
  arrayRemove as arrayRemove8
@@ -15055,9 +15274,9 @@ var TechnologyService = class extends BaseService {
15055
15274
  const q = query33(this.getTechnologiesRef(), where33("isActive", "==", true));
15056
15275
  const snapshot = await getDocs33(q);
15057
15276
  return snapshot.docs.map(
15058
- (doc35) => ({
15059
- id: doc35.id,
15060
- ...doc35.data()
15277
+ (doc36) => ({
15278
+ id: doc36.id,
15279
+ ...doc36.data()
15061
15280
  })
15062
15281
  );
15063
15282
  }
@@ -15074,9 +15293,9 @@ var TechnologyService = class extends BaseService {
15074
15293
  );
15075
15294
  const snapshot = await getDocs33(q);
15076
15295
  return snapshot.docs.map(
15077
- (doc35) => ({
15078
- id: doc35.id,
15079
- ...doc35.data()
15296
+ (doc36) => ({
15297
+ id: doc36.id,
15298
+ ...doc36.data()
15080
15299
  })
15081
15300
  );
15082
15301
  }
@@ -15093,9 +15312,9 @@ var TechnologyService = class extends BaseService {
15093
15312
  );
15094
15313
  const snapshot = await getDocs33(q);
15095
15314
  return snapshot.docs.map(
15096
- (doc35) => ({
15097
- id: doc35.id,
15098
- ...doc35.data()
15315
+ (doc36) => ({
15316
+ id: doc36.id,
15317
+ ...doc36.data()
15099
15318
  })
15100
15319
  );
15101
15320
  }
@@ -15112,9 +15331,9 @@ var TechnologyService = class extends BaseService {
15112
15331
  );
15113
15332
  const snapshot = await getDocs33(q);
15114
15333
  return snapshot.docs.map(
15115
- (doc35) => ({
15116
- id: doc35.id,
15117
- ...doc35.data()
15334
+ (doc36) => ({
15335
+ id: doc36.id,
15336
+ ...doc36.data()
15118
15337
  })
15119
15338
  );
15120
15339
  }
@@ -15129,8 +15348,8 @@ var TechnologyService = class extends BaseService {
15129
15348
  ...technology,
15130
15349
  updatedAt: /* @__PURE__ */ new Date()
15131
15350
  };
15132
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15133
- await updateDoc31(docRef, updateData);
15351
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15352
+ await updateDoc32(docRef, updateData);
15134
15353
  return this.getById(technologyId);
15135
15354
  }
15136
15355
  /**
@@ -15148,8 +15367,8 @@ var TechnologyService = class extends BaseService {
15148
15367
  * @returns Tehnologija ili null ako ne postoji
15149
15368
  */
15150
15369
  async getById(technologyId) {
15151
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15152
- const docSnap = await getDoc35(docRef);
15370
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15371
+ const docSnap = await getDoc36(docRef);
15153
15372
  if (!docSnap.exists()) return null;
15154
15373
  return {
15155
15374
  id: docSnap.id,
@@ -15163,9 +15382,9 @@ var TechnologyService = class extends BaseService {
15163
15382
  * @returns Ažurirana tehnologija sa novim zahtevom
15164
15383
  */
15165
15384
  async addRequirement(technologyId, requirement) {
15166
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15385
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15167
15386
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
15168
- await updateDoc31(docRef, {
15387
+ await updateDoc32(docRef, {
15169
15388
  [requirementType]: arrayUnion9(requirement),
15170
15389
  updatedAt: /* @__PURE__ */ new Date()
15171
15390
  });
@@ -15178,9 +15397,9 @@ var TechnologyService = class extends BaseService {
15178
15397
  * @returns Ažurirana tehnologija bez uklonjenog zahteva
15179
15398
  */
15180
15399
  async removeRequirement(technologyId, requirement) {
15181
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15400
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15182
15401
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
15183
- await updateDoc31(docRef, {
15402
+ await updateDoc32(docRef, {
15184
15403
  [requirementType]: arrayRemove8(requirement),
15185
15404
  updatedAt: /* @__PURE__ */ new Date()
15186
15405
  });
@@ -15218,8 +15437,8 @@ var TechnologyService = class extends BaseService {
15218
15437
  * @returns Ažurirana tehnologija
15219
15438
  */
15220
15439
  async addBlockingCondition(technologyId, condition) {
15221
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15222
- await updateDoc31(docRef, {
15440
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15441
+ await updateDoc32(docRef, {
15223
15442
  blockingConditions: arrayUnion9(condition),
15224
15443
  updatedAt: /* @__PURE__ */ new Date()
15225
15444
  });
@@ -15232,8 +15451,8 @@ var TechnologyService = class extends BaseService {
15232
15451
  * @returns Ažurirana tehnologija
15233
15452
  */
15234
15453
  async removeBlockingCondition(technologyId, condition) {
15235
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15236
- await updateDoc31(docRef, {
15454
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15455
+ await updateDoc32(docRef, {
15237
15456
  blockingConditions: arrayRemove8(condition),
15238
15457
  updatedAt: /* @__PURE__ */ new Date()
15239
15458
  });
@@ -15246,8 +15465,8 @@ var TechnologyService = class extends BaseService {
15246
15465
  * @returns Ažurirana tehnologija
15247
15466
  */
15248
15467
  async addContraindication(technologyId, contraindication) {
15249
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15250
- await updateDoc31(docRef, {
15468
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15469
+ await updateDoc32(docRef, {
15251
15470
  contraindications: arrayUnion9(contraindication),
15252
15471
  updatedAt: /* @__PURE__ */ new Date()
15253
15472
  });
@@ -15260,8 +15479,8 @@ var TechnologyService = class extends BaseService {
15260
15479
  * @returns Ažurirana tehnologija
15261
15480
  */
15262
15481
  async removeContraindication(technologyId, contraindication) {
15263
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15264
- await updateDoc31(docRef, {
15482
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15483
+ await updateDoc32(docRef, {
15265
15484
  contraindications: arrayRemove8(contraindication),
15266
15485
  updatedAt: /* @__PURE__ */ new Date()
15267
15486
  });
@@ -15274,8 +15493,8 @@ var TechnologyService = class extends BaseService {
15274
15493
  * @returns Ažurirana tehnologija
15275
15494
  */
15276
15495
  async addBenefit(technologyId, benefit) {
15277
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15278
- await updateDoc31(docRef, {
15496
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15497
+ await updateDoc32(docRef, {
15279
15498
  benefits: arrayUnion9(benefit),
15280
15499
  updatedAt: /* @__PURE__ */ new Date()
15281
15500
  });
@@ -15288,8 +15507,8 @@ var TechnologyService = class extends BaseService {
15288
15507
  * @returns Ažurirana tehnologija
15289
15508
  */
15290
15509
  async removeBenefit(technologyId, benefit) {
15291
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15292
- await updateDoc31(docRef, {
15510
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15511
+ await updateDoc32(docRef, {
15293
15512
  benefits: arrayRemove8(benefit),
15294
15513
  updatedAt: /* @__PURE__ */ new Date()
15295
15514
  });
@@ -15329,8 +15548,8 @@ var TechnologyService = class extends BaseService {
15329
15548
  * @returns Ažurirana tehnologija
15330
15549
  */
15331
15550
  async updateCertificationRequirement(technologyId, certificationRequirement) {
15332
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15333
- await updateDoc31(docRef, {
15551
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15552
+ await updateDoc32(docRef, {
15334
15553
  certificationRequirement,
15335
15554
  updatedAt: /* @__PURE__ */ new Date()
15336
15555
  });
@@ -15433,11 +15652,11 @@ var TechnologyService = class extends BaseService {
15433
15652
  import {
15434
15653
  addDoc as addDoc7,
15435
15654
  collection as collection34,
15436
- doc as doc34,
15437
- getDoc as getDoc36,
15655
+ doc as doc35,
15656
+ getDoc as getDoc37,
15438
15657
  getDocs as getDocs34,
15439
15658
  query as query34,
15440
- updateDoc as updateDoc32,
15659
+ updateDoc as updateDoc33,
15441
15660
  where as where34
15442
15661
  } from "firebase/firestore";
15443
15662
 
@@ -15488,9 +15707,9 @@ var ProductService = class extends BaseService {
15488
15707
  );
15489
15708
  const snapshot = await getDocs34(q);
15490
15709
  return snapshot.docs.map(
15491
- (doc35) => ({
15492
- id: doc35.id,
15493
- ...doc35.data()
15710
+ (doc36) => ({
15711
+ id: doc36.id,
15712
+ ...doc36.data()
15494
15713
  })
15495
15714
  );
15496
15715
  }
@@ -15510,9 +15729,9 @@ var ProductService = class extends BaseService {
15510
15729
  const snapshot = await getDocs34(q);
15511
15730
  products.push(
15512
15731
  ...snapshot.docs.map(
15513
- (doc35) => ({
15514
- id: doc35.id,
15515
- ...doc35.data()
15732
+ (doc36) => ({
15733
+ id: doc36.id,
15734
+ ...doc36.data()
15516
15735
  })
15517
15736
  )
15518
15737
  );
@@ -15527,8 +15746,8 @@ var ProductService = class extends BaseService {
15527
15746
  ...product,
15528
15747
  updatedAt: /* @__PURE__ */ new Date()
15529
15748
  };
15530
- const docRef = doc34(this.getProductsRef(technologyId), productId);
15531
- await updateDoc32(docRef, updateData);
15749
+ const docRef = doc35(this.getProductsRef(technologyId), productId);
15750
+ await updateDoc33(docRef, updateData);
15532
15751
  return this.getById(technologyId, productId);
15533
15752
  }
15534
15753
  /**
@@ -15543,8 +15762,8 @@ var ProductService = class extends BaseService {
15543
15762
  * Gets a product by ID
15544
15763
  */
15545
15764
  async getById(technologyId, productId) {
15546
- const docRef = doc34(this.getProductsRef(technologyId), productId);
15547
- const docSnap = await getDoc36(docRef);
15765
+ const docRef = doc35(this.getProductsRef(technologyId), productId);
15766
+ const docSnap = await getDoc37(docRef);
15548
15767
  if (!docSnap.exists()) return null;
15549
15768
  return {
15550
15769
  id: docSnap.id,
@@ -15666,6 +15885,7 @@ export {
15666
15885
  CalendarEventStatus,
15667
15886
  CalendarEventType,
15668
15887
  CalendarServiceV2,
15888
+ CalendarServiceV3,
15669
15889
  CalendarSyncStatus,
15670
15890
  CategoryService,
15671
15891
  CertificationLevel,
@@ -15772,6 +15992,7 @@ export {
15772
15992
  contraindicationSchema,
15773
15993
  createAdminTokenSchema,
15774
15994
  createAppointmentSchema,
15995
+ createBlockingEventSchema,
15775
15996
  createCalendarEventSchema,
15776
15997
  createClinicAdminSchema,
15777
15998
  createClinicGroupSchema,
@@ -15842,6 +16063,7 @@ export {
15842
16063
  updateAllergySchema,
15843
16064
  updateAppointmentSchema,
15844
16065
  updateBlockingConditionSchema,
16066
+ updateBlockingEventSchema,
15845
16067
  updateCalendarEventSchema,
15846
16068
  updateClinicAdminSchema,
15847
16069
  updateClinicGroupSchema,