@blackcode_sa/metaestetics-api 1.7.23 → 1.7.24

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
- (doc34) => doc34.data()
1299
+ (doc35) => doc35.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((doc34) => {
1981
- patients.push(doc34.data());
1980
+ patientsSnapshot.forEach((doc35) => {
1981
+ patients.push(doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
- if (!doc34.exists()) throw new Error("Medical info not found");
2213
- const medicalInfo = doc34.data();
2211
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
+ if (!doc35.exists()) throw new Error("Medical info not found");
2213
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
- if (!doc34.exists()) throw new Error("Medical info not found");
2240
- const medicalInfo = doc34.data();
2238
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
+ if (!doc35.exists()) throw new Error("Medical info not found");
2240
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
- if (!doc34.exists()) throw new Error("Medical info not found");
2258
- const medicalInfo = doc34.data();
2256
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
+ if (!doc35.exists()) throw new Error("Medical info not found");
2258
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
- if (!doc34.exists()) throw new Error("Medical info not found");
2285
- const medicalInfo = doc34.data();
2283
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
+ if (!doc35.exists()) throw new Error("Medical info not found");
2285
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
- if (!doc34.exists()) throw new Error("Medical info not found");
2303
- const medicalInfo = doc34.data();
2301
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
+ if (!doc35.exists()) throw new Error("Medical info not found");
2303
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
- if (!doc34.exists()) throw new Error("Medical info not found");
2330
- const medicalInfo = doc34.data();
2328
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
+ if (!doc35.exists()) throw new Error("Medical info not found");
2330
+ const medicalInfo = doc35.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 doc34 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
- if (!doc34.exists()) throw new Error("Medical info not found");
2348
- const medicalInfo = doc34.data();
2346
+ const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
+ if (!doc35.exists()) throw new Error("Medical info not found");
2348
+ const medicalInfo = doc35.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
- (doc34) => doc34.data()
2627
+ (doc35) => doc35.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((doc34) => {
2660
- patients.push(doc34.data());
2659
+ patientsSnapshot.forEach((doc35) => {
2660
+ patients.push(doc35.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((doc34) => {
2894
- patients.push(doc34.data());
2893
+ patientsSnapshot.forEach((doc35) => {
2894
+ patients.push(doc35.data());
2895
2895
  });
2896
2896
  console.log(
2897
2897
  `[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
@@ -3458,6 +3458,16 @@ var ClinicPhotoTag = /* @__PURE__ */ ((ClinicPhotoTag2) => {
3458
3458
  return ClinicPhotoTag2;
3459
3459
  })(ClinicPhotoTag || {});
3460
3460
 
3461
+ // src/types/clinic/practitioner-invite.types.ts
3462
+ var PRACTITIONER_INVITES_COLLECTION = "practitioner-invites";
3463
+ var PractitionerInviteStatus = /* @__PURE__ */ ((PractitionerInviteStatus2) => {
3464
+ PractitionerInviteStatus2["PENDING"] = "pending";
3465
+ PractitionerInviteStatus2["ACCEPTED"] = "accepted";
3466
+ PractitionerInviteStatus2["REJECTED"] = "rejected";
3467
+ PractitionerInviteStatus2["CANCELLED"] = "cancelled";
3468
+ return PractitionerInviteStatus2;
3469
+ })(PractitionerInviteStatus || {});
3470
+
3461
3471
  // src/types/clinic/index.ts
3462
3472
  var CLINIC_GROUPS_COLLECTION = "clinic_groups";
3463
3473
  var CLINIC_ADMINS_COLLECTION = "clinic_admins";
@@ -4161,7 +4171,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
4161
4171
  where6("clinicGroupId", "==", clinicGroupId)
4162
4172
  );
4163
4173
  const querySnapshot = await getDocs6(q);
4164
- return querySnapshot.docs.map((doc34) => doc34.data());
4174
+ return querySnapshot.docs.map((doc35) => doc35.data());
4165
4175
  }
4166
4176
  async function updateClinicAdmin(db, adminId, data) {
4167
4177
  const admin = await getClinicAdmin(db, adminId);
@@ -4915,7 +4925,7 @@ var PractitionerService = class extends BaseService {
4915
4925
  where7("expiresAt", ">", Timestamp10.now())
4916
4926
  );
4917
4927
  const querySnapshot = await getDocs7(q);
4918
- return querySnapshot.docs.map((doc34) => doc34.data());
4928
+ return querySnapshot.docs.map((doc35) => doc35.data());
4919
4929
  }
4920
4930
  /**
4921
4931
  * Gets a token by its string value and validates it
@@ -5025,7 +5035,7 @@ var PractitionerService = class extends BaseService {
5025
5035
  where7("status", "==", "active" /* ACTIVE */)
5026
5036
  );
5027
5037
  const querySnapshot = await getDocs7(q);
5028
- return querySnapshot.docs.map((doc34) => doc34.data());
5038
+ return querySnapshot.docs.map((doc35) => doc35.data());
5029
5039
  }
5030
5040
  /**
5031
5041
  * Dohvata sve zdravstvene radnike za određenu kliniku
@@ -5037,7 +5047,7 @@ var PractitionerService = class extends BaseService {
5037
5047
  where7("isActive", "==", true)
5038
5048
  );
5039
5049
  const querySnapshot = await getDocs7(q);
5040
- return querySnapshot.docs.map((doc34) => doc34.data());
5050
+ return querySnapshot.docs.map((doc35) => doc35.data());
5041
5051
  }
5042
5052
  /**
5043
5053
  * Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
@@ -5049,7 +5059,7 @@ var PractitionerService = class extends BaseService {
5049
5059
  where7("status", "==", "draft" /* DRAFT */)
5050
5060
  );
5051
5061
  const querySnapshot = await getDocs7(q);
5052
- return querySnapshot.docs.map((doc34) => doc34.data());
5062
+ return querySnapshot.docs.map((doc35) => doc35.data());
5053
5063
  }
5054
5064
  /**
5055
5065
  * Updates a practitioner
@@ -5263,7 +5273,7 @@ var PractitionerService = class extends BaseService {
5263
5273
  );
5264
5274
  const querySnapshot = await getDocs7(q);
5265
5275
  const practitioners = querySnapshot.docs.map(
5266
- (doc34) => doc34.data()
5276
+ (doc35) => doc35.data()
5267
5277
  );
5268
5278
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5269
5279
  return {
@@ -5334,8 +5344,8 @@ var PractitionerService = class extends BaseService {
5334
5344
  console.log(
5335
5345
  `[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
5336
5346
  );
5337
- let practitioners = querySnapshot.docs.map((doc34) => {
5338
- return { ...doc34.data(), id: doc34.id };
5347
+ let practitioners = querySnapshot.docs.map((doc35) => {
5348
+ return { ...doc35.data(), id: doc35.id };
5339
5349
  });
5340
5350
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5341
5351
  if (filters.nameSearch && filters.nameSearch.trim() !== "") {
@@ -5592,7 +5602,7 @@ var UserService = class extends BaseService {
5592
5602
  ];
5593
5603
  const q = query8(collection8(this.db, USERS_COLLECTION), ...constraints);
5594
5604
  const querySnapshot = await getDocs8(q);
5595
- const users = querySnapshot.docs.map((doc34) => doc34.data());
5605
+ const users = querySnapshot.docs.map((doc35) => doc35.data());
5596
5606
  return Promise.all(users.map((userData) => userSchema.parse(userData)));
5597
5607
  }
5598
5608
  /**
@@ -5972,7 +5982,7 @@ async function getAllActiveGroups(db) {
5972
5982
  where9("isActive", "==", true)
5973
5983
  );
5974
5984
  const querySnapshot = await getDocs9(q);
5975
- return querySnapshot.docs.map((doc34) => doc34.data());
5985
+ return querySnapshot.docs.map((doc35) => doc35.data());
5976
5986
  }
5977
5987
  async function updateClinicGroup(db, groupId, data, app) {
5978
5988
  console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
@@ -6437,7 +6447,7 @@ async function getClinicsByGroup(db, groupId) {
6437
6447
  where10("isActive", "==", true)
6438
6448
  );
6439
6449
  const querySnapshot = await getDocs10(q);
6440
- return querySnapshot.docs.map((doc34) => doc34.data());
6450
+ return querySnapshot.docs.map((doc35) => doc35.data());
6441
6451
  }
6442
6452
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
6443
6453
  console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
@@ -6631,7 +6641,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
6631
6641
  }
6632
6642
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6633
6643
  const querySnapshot = await getDocs10(q);
6634
- return querySnapshot.docs.map((doc34) => doc34.data());
6644
+ return querySnapshot.docs.map((doc35) => doc35.data());
6635
6645
  }
6636
6646
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
6637
6647
  return getClinicsByAdmin(
@@ -6676,11 +6686,11 @@ async function getAllClinics(db, pagination, lastDoc) {
6676
6686
  }
6677
6687
  const clinicsSnapshot = await getDocs10(clinicsQuery);
6678
6688
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
6679
- const clinics = clinicsSnapshot.docs.map((doc34) => {
6680
- const data = doc34.data();
6689
+ const clinics = clinicsSnapshot.docs.map((doc35) => {
6690
+ const data = doc35.data();
6681
6691
  return {
6682
6692
  ...data,
6683
- id: doc34.id
6693
+ id: doc35.id
6684
6694
  };
6685
6695
  });
6686
6696
  return {
@@ -6707,8 +6717,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
6707
6717
  ];
6708
6718
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6709
6719
  const querySnapshot = await getDocs10(q);
6710
- for (const doc34 of querySnapshot.docs) {
6711
- const clinic = doc34.data();
6720
+ for (const doc35 of querySnapshot.docs) {
6721
+ const clinic = doc35.data();
6712
6722
  const distance = distanceBetween2(
6713
6723
  [center.latitude, center.longitude],
6714
6724
  [clinic.location.latitude, clinic.location.longitude]
@@ -6830,8 +6840,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
6830
6840
  }
6831
6841
  const q = query11(collection11(db, CLINICS_COLLECTION), ...constraints);
6832
6842
  const querySnapshot = await getDocs11(q);
6833
- for (const doc34 of querySnapshot.docs) {
6834
- const clinic = doc34.data();
6843
+ for (const doc35 of querySnapshot.docs) {
6844
+ const clinic = doc35.data();
6835
6845
  const distance = distanceBetween3(
6836
6846
  [center.latitude, center.longitude],
6837
6847
  [clinic.location.latitude, clinic.location.longitude]
@@ -6927,8 +6937,8 @@ async function getClinicsByFilters(db, filters) {
6927
6937
  console.log(
6928
6938
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
6929
6939
  );
6930
- for (const doc34 of querySnapshot.docs) {
6931
- const clinic = { ...doc34.data(), id: doc34.id };
6940
+ for (const doc35 of querySnapshot.docs) {
6941
+ const clinic = { ...doc35.data(), id: doc35.id };
6932
6942
  const distance = distanceBetween4(
6933
6943
  [center.latitude, center.longitude],
6934
6944
  [clinic.location.latitude, clinic.location.longitude]
@@ -6984,8 +6994,8 @@ async function getClinicsByFilters(db, filters) {
6984
6994
  console.log(
6985
6995
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
6986
6996
  );
6987
- const clinics = querySnapshot.docs.map((doc34) => {
6988
- return { ...doc34.data(), id: doc34.id };
6997
+ const clinics = querySnapshot.docs.map((doc35) => {
6998
+ return { ...doc35.data(), id: doc35.id };
6989
6999
  });
6990
7000
  let filteredClinics = clinics;
6991
7001
  if (filters.center) {
@@ -8432,9 +8442,9 @@ var NotificationService = class extends BaseService {
8432
8442
  orderBy4("notificationTime", "desc")
8433
8443
  );
8434
8444
  const querySnapshot = await getDocs15(q);
8435
- return querySnapshot.docs.map((doc34) => ({
8436
- id: doc34.id,
8437
- ...doc34.data()
8445
+ return querySnapshot.docs.map((doc35) => ({
8446
+ id: doc35.id,
8447
+ ...doc35.data()
8438
8448
  }));
8439
8449
  }
8440
8450
  /**
@@ -8448,9 +8458,9 @@ var NotificationService = class extends BaseService {
8448
8458
  orderBy4("notificationTime", "desc")
8449
8459
  );
8450
8460
  const querySnapshot = await getDocs15(q);
8451
- return querySnapshot.docs.map((doc34) => ({
8452
- id: doc34.id,
8453
- ...doc34.data()
8461
+ return querySnapshot.docs.map((doc35) => ({
8462
+ id: doc35.id,
8463
+ ...doc35.data()
8454
8464
  }));
8455
8465
  }
8456
8466
  /**
@@ -8522,9 +8532,9 @@ var NotificationService = class extends BaseService {
8522
8532
  orderBy4("notificationTime", "desc")
8523
8533
  );
8524
8534
  const querySnapshot = await getDocs15(q);
8525
- return querySnapshot.docs.map((doc34) => ({
8526
- id: doc34.id,
8527
- ...doc34.data()
8535
+ return querySnapshot.docs.map((doc35) => ({
8536
+ id: doc35.id,
8537
+ ...doc35.data()
8528
8538
  }));
8529
8539
  }
8530
8540
  /**
@@ -8537,9 +8547,9 @@ var NotificationService = class extends BaseService {
8537
8547
  orderBy4("notificationTime", "desc")
8538
8548
  );
8539
8549
  const querySnapshot = await getDocs15(q);
8540
- return querySnapshot.docs.map((doc34) => ({
8541
- id: doc34.id,
8542
- ...doc34.data()
8550
+ return querySnapshot.docs.map((doc35) => ({
8551
+ id: doc35.id,
8552
+ ...doc35.data()
8543
8553
  }));
8544
8554
  }
8545
8555
  };
@@ -8834,7 +8844,7 @@ var ProcedureService = class extends BaseService {
8834
8844
  where16("isActive", "==", true)
8835
8845
  );
8836
8846
  const snapshot = await getDocs16(q);
8837
- return snapshot.docs.map((doc34) => doc34.data());
8847
+ return snapshot.docs.map((doc35) => doc35.data());
8838
8848
  }
8839
8849
  /**
8840
8850
  * Gets all procedures for a practitioner
@@ -8848,7 +8858,7 @@ var ProcedureService = class extends BaseService {
8848
8858
  where16("isActive", "==", true)
8849
8859
  );
8850
8860
  const snapshot = await getDocs16(q);
8851
- return snapshot.docs.map((doc34) => doc34.data());
8861
+ return snapshot.docs.map((doc35) => doc35.data());
8852
8862
  }
8853
8863
  /**
8854
8864
  * Updates a procedure
@@ -9039,20 +9049,20 @@ var ProcedureService = class extends BaseService {
9039
9049
  const proceduresCollection = collection16(this.db, PROCEDURES_COLLECTION);
9040
9050
  let proceduresQuery = query16(proceduresCollection);
9041
9051
  if (pagination && pagination > 0) {
9042
- const { limit: limit14, startAfter: startAfter13 } = await import("firebase/firestore");
9052
+ const { limit: limit15, startAfter: startAfter13 } = await import("firebase/firestore");
9043
9053
  if (lastDoc) {
9044
9054
  proceduresQuery = query16(
9045
9055
  proceduresCollection,
9046
9056
  orderBy5("name"),
9047
9057
  // Use imported orderBy
9048
9058
  startAfter13(lastDoc),
9049
- limit14(pagination)
9059
+ limit15(pagination)
9050
9060
  );
9051
9061
  } else {
9052
9062
  proceduresQuery = query16(
9053
9063
  proceduresCollection,
9054
9064
  orderBy5("name"),
9055
- limit14(pagination)
9065
+ limit15(pagination)
9056
9066
  );
9057
9067
  }
9058
9068
  } else {
@@ -9060,11 +9070,11 @@ var ProcedureService = class extends BaseService {
9060
9070
  }
9061
9071
  const proceduresSnapshot = await getDocs16(proceduresQuery);
9062
9072
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
9063
- const procedures = proceduresSnapshot.docs.map((doc34) => {
9064
- const data = doc34.data();
9073
+ const procedures = proceduresSnapshot.docs.map((doc35) => {
9074
+ const data = doc35.data();
9065
9075
  return {
9066
9076
  ...data,
9067
- id: doc34.id
9077
+ id: doc35.id
9068
9078
  // Ensure ID is present
9069
9079
  };
9070
9080
  });
@@ -9146,8 +9156,8 @@ var ProcedureService = class extends BaseService {
9146
9156
  console.log(
9147
9157
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
9148
9158
  );
9149
- for (const doc34 of querySnapshot.docs) {
9150
- const procedure = { ...doc34.data(), id: doc34.id };
9159
+ for (const doc35 of querySnapshot.docs) {
9160
+ const procedure = { ...doc35.data(), id: doc35.id };
9151
9161
  const distance = distanceBetween6(
9152
9162
  [center.latitude, center.longitude],
9153
9163
  [
@@ -9198,8 +9208,8 @@ var ProcedureService = class extends BaseService {
9198
9208
  console.log(
9199
9209
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
9200
9210
  );
9201
- const procedures = querySnapshot.docs.map((doc34) => {
9202
- return { ...doc34.data(), id: doc34.id };
9211
+ const procedures = querySnapshot.docs.map((doc35) => {
9212
+ return { ...doc35.data(), id: doc35.id };
9203
9213
  });
9204
9214
  if (filters.location) {
9205
9215
  const center = filters.location;
@@ -9305,25 +9315,430 @@ var ProcedureService = class extends BaseService {
9305
9315
  }
9306
9316
  };
9307
9317
 
9308
- // src/services/documentation-templates/documentation-template.service.ts
9318
+ // src/services/clinic/practitioner-invite.service.ts
9309
9319
  import {
9310
9320
  collection as collection17,
9311
9321
  doc as doc17,
9312
9322
  getDoc as getDoc20,
9313
9323
  getDocs as getDocs17,
9314
- setDoc as setDoc15,
9315
- updateDoc as updateDoc17,
9316
- deleteDoc as deleteDoc10,
9317
9324
  query as query17,
9318
9325
  where as where17,
9326
+ updateDoc as updateDoc17,
9327
+ setDoc as setDoc15,
9328
+ deleteDoc as deleteDoc10,
9329
+ Timestamp as Timestamp18,
9330
+ serverTimestamp as serverTimestamp15,
9319
9331
  orderBy as orderBy6,
9320
- limit as limit9,
9332
+ limit as limit9
9333
+ } from "firebase/firestore";
9334
+ var PractitionerInviteService = class extends BaseService {
9335
+ constructor(db, auth, app) {
9336
+ super(db, auth, app);
9337
+ }
9338
+ /**
9339
+ * Creates a new practitioner invite
9340
+ * @param practitionerId - Practitioner ID
9341
+ * @param clinicId - Clinic ID
9342
+ * @param proposedWorkingHours - Proposed working hours
9343
+ * @param invitedBy - Admin ID who creates the invite
9344
+ * @param message - Optional message
9345
+ * @returns Created invite
9346
+ */
9347
+ async createInviteAdmin(practitionerId, clinicId, proposedWorkingHours, invitedBy, message) {
9348
+ try {
9349
+ const inviteId = this.generateId();
9350
+ const [practitioner, clinic] = await Promise.all([
9351
+ this.getPractitionerById(practitionerId),
9352
+ this.getClinicById(clinicId)
9353
+ ]);
9354
+ if (!practitioner) {
9355
+ throw new Error(`Practitioner with ID ${practitionerId} not found`);
9356
+ }
9357
+ if (!clinic) {
9358
+ throw new Error(`Clinic with ID ${clinicId} not found`);
9359
+ }
9360
+ const existingInvite = await this.findExistingInvite(
9361
+ practitionerId,
9362
+ clinicId
9363
+ );
9364
+ if (existingInvite && existingInvite.status === "pending" /* PENDING */) {
9365
+ throw new Error(
9366
+ "There's already a pending invite for this practitioner at this clinic"
9367
+ );
9368
+ }
9369
+ const practitionerInfo = {
9370
+ id: practitioner.id,
9371
+ practitionerPhoto: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : null,
9372
+ name: `${practitioner.basicInfo.firstName} ${practitioner.basicInfo.lastName}`,
9373
+ email: practitioner.basicInfo.email,
9374
+ phone: practitioner.basicInfo.phoneNumber || null,
9375
+ certification: practitioner.certification
9376
+ };
9377
+ const clinicInfo = {
9378
+ id: clinic.id,
9379
+ featuredPhoto: typeof clinic.coverPhoto === "string" ? clinic.coverPhoto : "",
9380
+ name: clinic.name,
9381
+ description: clinic.description || null,
9382
+ location: clinic.location,
9383
+ contactInfo: clinic.contactInfo
9384
+ };
9385
+ const inviteData = {
9386
+ practitionerId,
9387
+ clinicId,
9388
+ practitionerInfo,
9389
+ clinicInfo,
9390
+ proposedWorkingHours,
9391
+ invitedBy,
9392
+ message: message || null,
9393
+ status: "pending" /* PENDING */
9394
+ };
9395
+ const now = Timestamp18.now();
9396
+ const invite = {
9397
+ id: inviteId,
9398
+ ...inviteData,
9399
+ status: "pending" /* PENDING */,
9400
+ createdAt: now,
9401
+ updatedAt: now,
9402
+ acceptedAt: null,
9403
+ rejectedAt: null,
9404
+ cancelledAt: null
9405
+ };
9406
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9407
+ await setDoc15(docRef, invite);
9408
+ return invite;
9409
+ } catch (error) {
9410
+ console.error(
9411
+ "[PractitionerInviteService] Error creating invite:",
9412
+ error
9413
+ );
9414
+ throw error;
9415
+ }
9416
+ }
9417
+ /**
9418
+ * Gets all invites for a specific doctor/practitioner
9419
+ * @param practitionerId - Practitioner ID
9420
+ * @param statusFilter - Optional status filter
9421
+ * @returns Array of invites
9422
+ */
9423
+ async getAllInvitesDoctor(practitionerId, statusFilter) {
9424
+ try {
9425
+ const constraints = [
9426
+ where17("practitionerId", "==", practitionerId),
9427
+ orderBy6("createdAt", "desc")
9428
+ ];
9429
+ if (statusFilter && statusFilter.length > 0) {
9430
+ constraints.push(where17("status", "in", statusFilter));
9431
+ }
9432
+ const q = query17(
9433
+ collection17(this.db, PRACTITIONER_INVITES_COLLECTION),
9434
+ ...constraints
9435
+ );
9436
+ const querySnapshot = await getDocs17(q);
9437
+ return querySnapshot.docs.map((doc35) => doc35.data());
9438
+ } catch (error) {
9439
+ console.error(
9440
+ "[PractitionerInviteService] Error getting doctor invites:",
9441
+ error
9442
+ );
9443
+ throw error;
9444
+ }
9445
+ }
9446
+ /**
9447
+ * Gets all invites for a specific clinic
9448
+ * @param clinicId - Clinic ID
9449
+ * @param statusFilter - Optional status filter
9450
+ * @returns Array of invites
9451
+ */
9452
+ async getAllInvitesClinic(clinicId, statusFilter) {
9453
+ try {
9454
+ const constraints = [
9455
+ where17("clinicId", "==", clinicId),
9456
+ orderBy6("createdAt", "desc")
9457
+ ];
9458
+ if (statusFilter && statusFilter.length > 0) {
9459
+ constraints.push(where17("status", "in", statusFilter));
9460
+ }
9461
+ const q = query17(
9462
+ collection17(this.db, PRACTITIONER_INVITES_COLLECTION),
9463
+ ...constraints
9464
+ );
9465
+ const querySnapshot = await getDocs17(q);
9466
+ return querySnapshot.docs.map((doc35) => doc35.data());
9467
+ } catch (error) {
9468
+ console.error(
9469
+ "[PractitionerInviteService] Error getting clinic invites:",
9470
+ error
9471
+ );
9472
+ throw error;
9473
+ }
9474
+ }
9475
+ /**
9476
+ * Doctor accepts an invite
9477
+ * @param inviteId - Invite ID
9478
+ * @returns Updated invite
9479
+ */
9480
+ async acceptInviteDoctor(inviteId) {
9481
+ try {
9482
+ const invite = await this.getInviteById(inviteId);
9483
+ if (!invite) {
9484
+ throw new Error(`Invite with ID ${inviteId} not found`);
9485
+ }
9486
+ if (invite.status !== "pending" /* PENDING */) {
9487
+ throw new Error("Only pending invites can be accepted");
9488
+ }
9489
+ const updateData = {
9490
+ status: "accepted" /* ACCEPTED */,
9491
+ acceptedAt: Timestamp18.now(),
9492
+ updatedAt: serverTimestamp15()
9493
+ };
9494
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9495
+ await updateDoc17(docRef, updateData);
9496
+ return await this.getInviteById(inviteId);
9497
+ } catch (error) {
9498
+ console.error(
9499
+ "[PractitionerInviteService] Error accepting invite:",
9500
+ error
9501
+ );
9502
+ throw error;
9503
+ }
9504
+ }
9505
+ /**
9506
+ * Doctor rejects an invite
9507
+ * @param inviteId - Invite ID
9508
+ * @param rejectionReason - Optional reason for rejection
9509
+ * @returns Updated invite
9510
+ */
9511
+ async rejectInviteDoctor(inviteId, rejectionReason) {
9512
+ try {
9513
+ const invite = await this.getInviteById(inviteId);
9514
+ if (!invite) {
9515
+ throw new Error(`Invite with ID ${inviteId} not found`);
9516
+ }
9517
+ if (invite.status !== "pending" /* PENDING */) {
9518
+ throw new Error("Only pending invites can be rejected");
9519
+ }
9520
+ const updateData = {
9521
+ status: "rejected" /* REJECTED */,
9522
+ rejectionReason: rejectionReason || null,
9523
+ rejectedAt: Timestamp18.now(),
9524
+ updatedAt: serverTimestamp15()
9525
+ };
9526
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9527
+ await updateDoc17(docRef, updateData);
9528
+ return await this.getInviteById(inviteId);
9529
+ } catch (error) {
9530
+ console.error(
9531
+ "[PractitionerInviteService] Error rejecting invite:",
9532
+ error
9533
+ );
9534
+ throw error;
9535
+ }
9536
+ }
9537
+ /**
9538
+ * Admin cancels an invite
9539
+ * @param inviteId - Invite ID
9540
+ * @param cancelReason - Optional reason for cancellation
9541
+ * @returns Updated invite
9542
+ */
9543
+ async cancelInviteAdmin(inviteId, cancelReason) {
9544
+ try {
9545
+ const invite = await this.getInviteById(inviteId);
9546
+ if (!invite) {
9547
+ throw new Error(`Invite with ID ${inviteId} not found`);
9548
+ }
9549
+ if (invite.status !== "pending" /* PENDING */) {
9550
+ throw new Error("Only pending invites can be cancelled");
9551
+ }
9552
+ const updateData = {
9553
+ status: "cancelled" /* CANCELLED */,
9554
+ cancelReason: cancelReason || null,
9555
+ cancelledAt: Timestamp18.now(),
9556
+ updatedAt: serverTimestamp15()
9557
+ };
9558
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9559
+ await updateDoc17(docRef, updateData);
9560
+ return await this.getInviteById(inviteId);
9561
+ } catch (error) {
9562
+ console.error(
9563
+ "[PractitionerInviteService] Error cancelling invite:",
9564
+ error
9565
+ );
9566
+ throw error;
9567
+ }
9568
+ }
9569
+ /**
9570
+ * Gets an invite by ID
9571
+ * @param inviteId - Invite ID
9572
+ * @returns Invite or null if not found
9573
+ */
9574
+ async getInviteById(inviteId) {
9575
+ try {
9576
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9577
+ const docSnap = await getDoc20(docRef);
9578
+ if (docSnap.exists()) {
9579
+ return docSnap.data();
9580
+ }
9581
+ return null;
9582
+ } catch (error) {
9583
+ console.error(
9584
+ "[PractitionerInviteService] Error getting invite by ID:",
9585
+ error
9586
+ );
9587
+ throw error;
9588
+ }
9589
+ }
9590
+ /**
9591
+ * Gets invites with advanced filtering options
9592
+ * @param filters - Filter options
9593
+ * @returns Array of filtered invites
9594
+ */
9595
+ async getInvitesWithFilters(filters) {
9596
+ try {
9597
+ const constraints = [];
9598
+ if (filters.practitionerId) {
9599
+ constraints.push(where17("practitionerId", "==", filters.practitionerId));
9600
+ }
9601
+ if (filters.clinicId) {
9602
+ constraints.push(where17("clinicId", "==", filters.clinicId));
9603
+ }
9604
+ if (filters.invitedBy) {
9605
+ constraints.push(where17("invitedBy", "==", filters.invitedBy));
9606
+ }
9607
+ if (filters.status && filters.status.length > 0) {
9608
+ constraints.push(where17("status", "in", filters.status));
9609
+ }
9610
+ const orderField = filters.orderBy || "createdAt";
9611
+ const orderDirection = filters.orderDirection || "desc";
9612
+ constraints.push(orderBy6(orderField, orderDirection));
9613
+ if (filters.limit) {
9614
+ constraints.push(limit9(filters.limit));
9615
+ }
9616
+ const q = query17(
9617
+ collection17(this.db, PRACTITIONER_INVITES_COLLECTION),
9618
+ ...constraints
9619
+ );
9620
+ const querySnapshot = await getDocs17(q);
9621
+ let invites = querySnapshot.docs.map(
9622
+ (doc35) => doc35.data()
9623
+ );
9624
+ if (filters.fromDate) {
9625
+ invites = invites.filter(
9626
+ (invite) => invite.createdAt >= filters.fromDate
9627
+ );
9628
+ }
9629
+ if (filters.toDate) {
9630
+ invites = invites.filter(
9631
+ (invite) => invite.createdAt <= filters.toDate
9632
+ );
9633
+ }
9634
+ return invites;
9635
+ } catch (error) {
9636
+ console.error(
9637
+ "[PractitionerInviteService] Error getting invites with filters:",
9638
+ error
9639
+ );
9640
+ throw error;
9641
+ }
9642
+ }
9643
+ /**
9644
+ * Deletes an invite (admin only)
9645
+ * @param inviteId - Invite ID
9646
+ */
9647
+ async deleteInvite(inviteId) {
9648
+ try {
9649
+ const docRef = doc17(this.db, PRACTITIONER_INVITES_COLLECTION, inviteId);
9650
+ await deleteDoc10(docRef);
9651
+ } catch (error) {
9652
+ console.error(
9653
+ "[PractitionerInviteService] Error deleting invite:",
9654
+ error
9655
+ );
9656
+ throw error;
9657
+ }
9658
+ }
9659
+ // Private helper methods
9660
+ /**
9661
+ * Gets practitioner by ID
9662
+ * @param practitionerId - Practitioner ID
9663
+ * @returns Practitioner or null
9664
+ */
9665
+ async getPractitionerById(practitionerId) {
9666
+ try {
9667
+ const docRef = doc17(this.db, PRACTITIONERS_COLLECTION, practitionerId);
9668
+ const docSnap = await getDoc20(docRef);
9669
+ return docSnap.exists() ? docSnap.data() : null;
9670
+ } catch (error) {
9671
+ console.error(
9672
+ "[PractitionerInviteService] Error getting practitioner:",
9673
+ error
9674
+ );
9675
+ return null;
9676
+ }
9677
+ }
9678
+ /**
9679
+ * Gets clinic by ID
9680
+ * @param clinicId - Clinic ID
9681
+ * @returns Clinic or null
9682
+ */
9683
+ async getClinicById(clinicId) {
9684
+ try {
9685
+ const docRef = doc17(this.db, CLINICS_COLLECTION, clinicId);
9686
+ const docSnap = await getDoc20(docRef);
9687
+ return docSnap.exists() ? docSnap.data() : null;
9688
+ } catch (error) {
9689
+ console.error("[PractitionerInviteService] Error getting clinic:", error);
9690
+ return null;
9691
+ }
9692
+ }
9693
+ /**
9694
+ * Finds existing invite between practitioner and clinic
9695
+ * @param practitionerId - Practitioner ID
9696
+ * @param clinicId - Clinic ID
9697
+ * @returns Existing invite or null
9698
+ */
9699
+ async findExistingInvite(practitionerId, clinicId) {
9700
+ try {
9701
+ const q = query17(
9702
+ collection17(this.db, PRACTITIONER_INVITES_COLLECTION),
9703
+ where17("practitionerId", "==", practitionerId),
9704
+ where17("clinicId", "==", clinicId),
9705
+ orderBy6("createdAt", "desc"),
9706
+ limit9(1)
9707
+ );
9708
+ const querySnapshot = await getDocs17(q);
9709
+ if (querySnapshot.empty) {
9710
+ return null;
9711
+ }
9712
+ return querySnapshot.docs[0].data();
9713
+ } catch (error) {
9714
+ console.error(
9715
+ "[PractitionerInviteService] Error finding existing invite:",
9716
+ error
9717
+ );
9718
+ return null;
9719
+ }
9720
+ }
9721
+ };
9722
+
9723
+ // src/services/documentation-templates/documentation-template.service.ts
9724
+ import {
9725
+ collection as collection18,
9726
+ doc as doc18,
9727
+ getDoc as getDoc21,
9728
+ getDocs as getDocs18,
9729
+ setDoc as setDoc16,
9730
+ updateDoc as updateDoc18,
9731
+ deleteDoc as deleteDoc11,
9732
+ query as query18,
9733
+ where as where18,
9734
+ orderBy as orderBy7,
9735
+ limit as limit10,
9321
9736
  startAfter as startAfter8
9322
9737
  } from "firebase/firestore";
9323
9738
  var DocumentationTemplateService = class extends BaseService {
9324
9739
  constructor() {
9325
9740
  super(...arguments);
9326
- this.collectionRef = collection17(
9741
+ this.collectionRef = collection18(
9327
9742
  this.db,
9328
9743
  DOCUMENTATION_TEMPLATES_COLLECTION
9329
9744
  );
@@ -9357,8 +9772,8 @@ var DocumentationTemplateService = class extends BaseService {
9357
9772
  isRequired: validatedData.isRequired || false,
9358
9773
  sortingOrder: validatedData.sortingOrder || 0
9359
9774
  };
9360
- const docRef = doc17(this.collectionRef, templateId);
9361
- await setDoc15(docRef, template);
9775
+ const docRef = doc18(this.collectionRef, templateId);
9776
+ await setDoc16(docRef, template);
9362
9777
  return template;
9363
9778
  }
9364
9779
  /**
@@ -9368,8 +9783,8 @@ var DocumentationTemplateService = class extends BaseService {
9368
9783
  * @returns The template or null if not found
9369
9784
  */
9370
9785
  async getTemplateById(templateId, version) {
9371
- const docRef = doc17(this.collectionRef, templateId);
9372
- const docSnap = await getDoc20(docRef);
9786
+ const docRef = doc18(this.collectionRef, templateId);
9787
+ const docSnap = await getDoc21(docRef);
9373
9788
  if (!docSnap.exists()) {
9374
9789
  return null;
9375
9790
  }
@@ -9407,15 +9822,15 @@ var DocumentationTemplateService = class extends BaseService {
9407
9822
  if (!template) {
9408
9823
  throw new Error(`Template with ID ${templateId} not found`);
9409
9824
  }
9410
- const versionsCollectionRef = collection17(
9825
+ const versionsCollectionRef = collection18(
9411
9826
  this.db,
9412
9827
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
9413
9828
  );
9414
- const versionDocRef = doc17(
9829
+ const versionDocRef = doc18(
9415
9830
  versionsCollectionRef,
9416
9831
  template.version.toString()
9417
9832
  );
9418
- await setDoc15(versionDocRef, template);
9833
+ await setDoc16(versionDocRef, template);
9419
9834
  let updatedElements = template.elements;
9420
9835
  if (validatedData.elements) {
9421
9836
  updatedElements = validatedData.elements.map((element) => ({
@@ -9439,9 +9854,9 @@ var DocumentationTemplateService = class extends BaseService {
9439
9854
  updatePayload.isUserForm = (_a = validatedData.isUserForm) != null ? _a : false;
9440
9855
  updatePayload.isRequired = (_b = validatedData.isRequired) != null ? _b : false;
9441
9856
  updatePayload.sortingOrder = (_c = validatedData.sortingOrder) != null ? _c : 0;
9442
- const docRef = doc17(this.collectionRef, templateId);
9857
+ const docRef = doc18(this.collectionRef, templateId);
9443
9858
  console.log("Update payload", updatePayload);
9444
- await updateDoc17(docRef, updatePayload);
9859
+ await updateDoc18(docRef, updatePayload);
9445
9860
  return { ...template, ...updatePayload };
9446
9861
  }
9447
9862
  /**
@@ -9451,11 +9866,11 @@ var DocumentationTemplateService = class extends BaseService {
9451
9866
  * @returns The template version or null if not found
9452
9867
  */
9453
9868
  async getTemplateVersion(templateId, versionNumber) {
9454
- const versionDocRef = doc17(
9869
+ const versionDocRef = doc18(
9455
9870
  this.db,
9456
9871
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions/${versionNumber}`
9457
9872
  );
9458
- const versionDocSnap = await getDoc20(versionDocRef);
9873
+ const versionDocSnap = await getDoc21(versionDocRef);
9459
9874
  if (!versionDocSnap.exists()) {
9460
9875
  return null;
9461
9876
  }
@@ -9467,15 +9882,15 @@ var DocumentationTemplateService = class extends BaseService {
9467
9882
  * @returns Array of template versions
9468
9883
  */
9469
9884
  async getTemplateOldVersions(templateId) {
9470
- const versionsCollectionRef = collection17(
9885
+ const versionsCollectionRef = collection18(
9471
9886
  this.db,
9472
9887
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
9473
9888
  );
9474
- const q = query17(versionsCollectionRef, orderBy6("version", "desc"));
9475
- const querySnapshot = await getDocs17(q);
9889
+ const q = query18(versionsCollectionRef, orderBy7("version", "desc"));
9890
+ const querySnapshot = await getDocs18(q);
9476
9891
  const versions = [];
9477
- querySnapshot.forEach((doc34) => {
9478
- versions.push(doc34.data());
9892
+ querySnapshot.forEach((doc35) => {
9893
+ versions.push(doc35.data());
9479
9894
  });
9480
9895
  return versions;
9481
9896
  }
@@ -9484,8 +9899,8 @@ var DocumentationTemplateService = class extends BaseService {
9484
9899
  * @param templateId - ID of the template to delete
9485
9900
  */
9486
9901
  async deleteTemplate(templateId) {
9487
- const docRef = doc17(this.collectionRef, templateId);
9488
- await deleteDoc10(docRef);
9902
+ const docRef = doc18(this.collectionRef, templateId);
9903
+ await deleteDoc11(docRef);
9489
9904
  }
9490
9905
  /**
9491
9906
  * Get all active templates
@@ -9494,21 +9909,21 @@ var DocumentationTemplateService = class extends BaseService {
9494
9909
  * @returns Array of templates and the last document for pagination
9495
9910
  */
9496
9911
  async getActiveTemplates(pageSize = 20, lastDoc) {
9497
- let q = query17(
9912
+ let q = query18(
9498
9913
  this.collectionRef,
9499
- where17("isActive", "==", true),
9500
- orderBy6("updatedAt", "desc"),
9501
- limit9(pageSize)
9914
+ where18("isActive", "==", true),
9915
+ orderBy7("updatedAt", "desc"),
9916
+ limit10(pageSize)
9502
9917
  );
9503
9918
  if (lastDoc) {
9504
- q = query17(q, startAfter8(lastDoc));
9919
+ q = query18(q, startAfter8(lastDoc));
9505
9920
  }
9506
- const querySnapshot = await getDocs17(q);
9921
+ const querySnapshot = await getDocs18(q);
9507
9922
  const templates = [];
9508
9923
  let lastVisible = null;
9509
- querySnapshot.forEach((doc34) => {
9510
- templates.push(doc34.data());
9511
- lastVisible = doc34;
9924
+ querySnapshot.forEach((doc35) => {
9925
+ templates.push(doc35.data());
9926
+ lastVisible = doc35;
9512
9927
  });
9513
9928
  return {
9514
9929
  templates,
@@ -9523,22 +9938,22 @@ var DocumentationTemplateService = class extends BaseService {
9523
9938
  * @returns Array of templates and the last document for pagination
9524
9939
  */
9525
9940
  async getTemplatesByTags(tags, pageSize = 20, lastDoc) {
9526
- let q = query17(
9941
+ let q = query18(
9527
9942
  this.collectionRef,
9528
- where17("isActive", "==", true),
9529
- where17("tags", "array-contains-any", tags),
9530
- orderBy6("updatedAt", "desc"),
9531
- limit9(pageSize)
9943
+ where18("isActive", "==", true),
9944
+ where18("tags", "array-contains-any", tags),
9945
+ orderBy7("updatedAt", "desc"),
9946
+ limit10(pageSize)
9532
9947
  );
9533
9948
  if (lastDoc) {
9534
- q = query17(q, startAfter8(lastDoc));
9949
+ q = query18(q, startAfter8(lastDoc));
9535
9950
  }
9536
- const querySnapshot = await getDocs17(q);
9951
+ const querySnapshot = await getDocs18(q);
9537
9952
  const templates = [];
9538
9953
  let lastVisible = null;
9539
- querySnapshot.forEach((doc34) => {
9540
- templates.push(doc34.data());
9541
- lastVisible = doc34;
9954
+ querySnapshot.forEach((doc35) => {
9955
+ templates.push(doc35.data());
9956
+ lastVisible = doc35;
9542
9957
  });
9543
9958
  return {
9544
9959
  templates,
@@ -9553,21 +9968,21 @@ var DocumentationTemplateService = class extends BaseService {
9553
9968
  * @returns Array of templates and the last document for pagination
9554
9969
  */
9555
9970
  async getTemplatesByCreator(userId, pageSize = 20, lastDoc) {
9556
- let q = query17(
9971
+ let q = query18(
9557
9972
  this.collectionRef,
9558
- where17("createdBy", "==", userId),
9559
- orderBy6("updatedAt", "desc"),
9560
- limit9(pageSize)
9973
+ where18("createdBy", "==", userId),
9974
+ orderBy7("updatedAt", "desc"),
9975
+ limit10(pageSize)
9561
9976
  );
9562
9977
  if (lastDoc) {
9563
- q = query17(q, startAfter8(lastDoc));
9978
+ q = query18(q, startAfter8(lastDoc));
9564
9979
  }
9565
- const querySnapshot = await getDocs17(q);
9980
+ const querySnapshot = await getDocs18(q);
9566
9981
  const templates = [];
9567
9982
  let lastVisible = null;
9568
- querySnapshot.forEach((doc34) => {
9569
- templates.push(doc34.data());
9570
- lastVisible = doc34;
9983
+ querySnapshot.forEach((doc35) => {
9984
+ templates.push(doc35.data());
9985
+ lastVisible = doc35;
9571
9986
  });
9572
9987
  return {
9573
9988
  templates,
@@ -9580,21 +9995,21 @@ var DocumentationTemplateService = class extends BaseService {
9580
9995
  * @returns Array of templates
9581
9996
  */
9582
9997
  async getAllTemplatesForSelection(options) {
9583
- let q = query17(
9998
+ let q = query18(
9584
9999
  this.collectionRef,
9585
- where17("isActive", "==", true),
9586
- orderBy6("updatedAt", "desc")
10000
+ where18("isActive", "==", true),
10001
+ orderBy7("updatedAt", "desc")
9587
10002
  );
9588
10003
  if ((options == null ? void 0 : options.isUserForm) !== void 0) {
9589
- q = query17(q, where17("isUserForm", "==", options.isUserForm));
10004
+ q = query18(q, where18("isUserForm", "==", options.isUserForm));
9590
10005
  }
9591
10006
  if ((options == null ? void 0 : options.isRequired) !== void 0) {
9592
- q = query17(q, where17("isRequired", "==", options.isRequired));
10007
+ q = query18(q, where18("isRequired", "==", options.isRequired));
9593
10008
  }
9594
- const querySnapshot = await getDocs17(q);
10009
+ const querySnapshot = await getDocs18(q);
9595
10010
  const templates = [];
9596
- querySnapshot.forEach((doc34) => {
9597
- templates.push(doc34.data());
10011
+ querySnapshot.forEach((doc35) => {
10012
+ templates.push(doc35.data());
9598
10013
  });
9599
10014
  return templates;
9600
10015
  }
@@ -9602,15 +10017,15 @@ var DocumentationTemplateService = class extends BaseService {
9602
10017
 
9603
10018
  // src/services/documentation-templates/filled-document.service.ts
9604
10019
  import {
9605
- collection as collection18,
9606
- doc as doc18,
9607
- getDoc as getDoc21,
9608
- getDocs as getDocs18,
9609
- setDoc as setDoc16,
9610
- updateDoc as updateDoc18,
9611
- query as query18,
9612
- orderBy as orderBy7,
9613
- limit as limit10,
10020
+ collection as collection19,
10021
+ doc as doc19,
10022
+ getDoc as getDoc22,
10023
+ getDocs as getDocs19,
10024
+ setDoc as setDoc17,
10025
+ updateDoc as updateDoc19,
10026
+ query as query19,
10027
+ orderBy as orderBy8,
10028
+ limit as limit11,
9614
10029
  startAfter as startAfter9
9615
10030
  } from "firebase/firestore";
9616
10031
  var FilledDocumentService = class extends BaseService {
@@ -9667,7 +10082,7 @@ var FilledDocumentService = class extends BaseService {
9667
10082
  values: initialValues,
9668
10083
  status: initialStatus
9669
10084
  };
9670
- const docRef = doc18(
10085
+ const docRef = doc19(
9671
10086
  this.db,
9672
10087
  APPOINTMENTS_COLLECTION,
9673
10088
  // Replaced "appointments"
@@ -9675,7 +10090,7 @@ var FilledDocumentService = class extends BaseService {
9675
10090
  formSubcollection,
9676
10091
  documentId3
9677
10092
  );
9678
- await setDoc16(docRef, filledDocument);
10093
+ await setDoc17(docRef, filledDocument);
9679
10094
  return filledDocument;
9680
10095
  }
9681
10096
  /**
@@ -9687,7 +10102,7 @@ var FilledDocumentService = class extends BaseService {
9687
10102
  */
9688
10103
  async getFilledDocumentFromAppointmentById(appointmentId, formId, isUserForm) {
9689
10104
  const formSubcollection = this.getFormSubcollectionPath(isUserForm);
9690
- const docRef = doc18(
10105
+ const docRef = doc19(
9691
10106
  this.db,
9692
10107
  APPOINTMENTS_COLLECTION,
9693
10108
  // Replaced "appointments"
@@ -9695,7 +10110,7 @@ var FilledDocumentService = class extends BaseService {
9695
10110
  formSubcollection,
9696
10111
  formId
9697
10112
  );
9698
- const docSnap = await getDoc21(docRef);
10113
+ const docSnap = await getDoc22(docRef);
9699
10114
  if (!docSnap.exists()) {
9700
10115
  return null;
9701
10116
  }
@@ -9712,7 +10127,7 @@ var FilledDocumentService = class extends BaseService {
9712
10127
  */
9713
10128
  async updateFilledDocumentInAppointment(appointmentId, formId, isUserForm, values, status) {
9714
10129
  const formSubcollection = this.getFormSubcollectionPath(isUserForm);
9715
- const docRef = doc18(
10130
+ const docRef = doc19(
9716
10131
  this.db,
9717
10132
  APPOINTMENTS_COLLECTION,
9718
10133
  // Replaced "appointments"
@@ -9744,7 +10159,7 @@ var FilledDocumentService = class extends BaseService {
9744
10159
  }
9745
10160
  if (Object.keys(updatePayload).length === 1 && "updatedAt" in updatePayload) {
9746
10161
  }
9747
- await updateDoc18(docRef, updatePayload);
10162
+ await updateDoc19(docRef, updatePayload);
9748
10163
  return { ...existingDoc, ...updatePayload };
9749
10164
  }
9750
10165
  /**
@@ -9754,20 +10169,20 @@ var FilledDocumentService = class extends BaseService {
9754
10169
  * @param lastDoc Last document from previous page for pagination.
9755
10170
  */
9756
10171
  async getFilledUserFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
9757
- const subcollectionRef = collection18(
10172
+ const subcollectionRef = collection19(
9758
10173
  this.db,
9759
10174
  APPOINTMENTS_COLLECTION,
9760
10175
  // Replaced "appointments"
9761
10176
  appointmentId,
9762
10177
  USER_FORMS_SUBCOLLECTION
9763
10178
  );
9764
- let q = query18(
10179
+ let q = query19(
9765
10180
  subcollectionRef,
9766
- orderBy7("updatedAt", "desc"),
9767
- limit10(pageSize)
10181
+ orderBy8("updatedAt", "desc"),
10182
+ limit11(pageSize)
9768
10183
  );
9769
10184
  if (lastDoc) {
9770
- q = query18(q, startAfter9(lastDoc));
10185
+ q = query19(q, startAfter9(lastDoc));
9771
10186
  }
9772
10187
  return this.executeQuery(q);
9773
10188
  }
@@ -9778,31 +10193,31 @@ var FilledDocumentService = class extends BaseService {
9778
10193
  * @param lastDoc Last document from previous page for pagination.
9779
10194
  */
9780
10195
  async getFilledDoctorFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
9781
- const subcollectionRef = collection18(
10196
+ const subcollectionRef = collection19(
9782
10197
  this.db,
9783
10198
  APPOINTMENTS_COLLECTION,
9784
10199
  // Replaced "appointments"
9785
10200
  appointmentId,
9786
10201
  DOCTOR_FORMS_SUBCOLLECTION
9787
10202
  );
9788
- let q = query18(
10203
+ let q = query19(
9789
10204
  subcollectionRef,
9790
- orderBy7("updatedAt", "desc"),
9791
- limit10(pageSize)
10205
+ orderBy8("updatedAt", "desc"),
10206
+ limit11(pageSize)
9792
10207
  );
9793
10208
  if (lastDoc) {
9794
- q = query18(q, startAfter9(lastDoc));
10209
+ q = query19(q, startAfter9(lastDoc));
9795
10210
  }
9796
10211
  return this.executeQuery(q);
9797
10212
  }
9798
10213
  // Helper to execute query and return documents + lastDoc
9799
10214
  async executeQuery(q) {
9800
- const querySnapshot = await getDocs18(q);
10215
+ const querySnapshot = await getDocs19(q);
9801
10216
  const documents = [];
9802
10217
  let lastVisible = null;
9803
- querySnapshot.forEach((doc34) => {
9804
- documents.push(doc34.data());
9805
- lastVisible = doc34;
10218
+ querySnapshot.forEach((doc35) => {
10219
+ documents.push(doc35.data());
10220
+ lastVisible = doc35;
9806
10221
  });
9807
10222
  return {
9808
10223
  documents,
@@ -9961,7 +10376,7 @@ var FilledDocumentService = class extends BaseService {
9961
10376
  };
9962
10377
 
9963
10378
  // src/services/calendar/calendar-refactored.service.ts
9964
- import { Timestamp as Timestamp27, serverTimestamp as serverTimestamp21 } from "firebase/firestore";
10379
+ import { Timestamp as Timestamp28, serverTimestamp as serverTimestamp22 } from "firebase/firestore";
9965
10380
 
9966
10381
  // src/types/calendar/synced-calendar.types.ts
9967
10382
  var SyncedCalendarProvider = /* @__PURE__ */ ((SyncedCalendarProvider3) => {
@@ -9974,23 +10389,23 @@ var SYNCED_CALENDARS_COLLECTION = "syncedCalendars";
9974
10389
 
9975
10390
  // src/services/calendar/calendar-refactored.service.ts
9976
10391
  import {
9977
- doc as doc25,
9978
- getDoc as getDoc27,
9979
- collection as collection24,
9980
- query as query24,
9981
- where as where24,
9982
- getDocs as getDocs24,
9983
- setDoc as setDoc22,
9984
- updateDoc as updateDoc24
10392
+ doc as doc26,
10393
+ getDoc as getDoc28,
10394
+ collection as collection25,
10395
+ query as query25,
10396
+ where as where25,
10397
+ getDocs as getDocs25,
10398
+ setDoc as setDoc23,
10399
+ updateDoc as updateDoc25
9985
10400
  } from "firebase/firestore";
9986
10401
 
9987
10402
  // src/validations/calendar.schema.ts
9988
10403
  import { z as z23 } from "zod";
9989
- import { Timestamp as Timestamp20 } from "firebase/firestore";
10404
+ import { Timestamp as Timestamp21 } from "firebase/firestore";
9990
10405
 
9991
10406
  // src/validations/profile-info.schema.ts
9992
10407
  import { z as z22 } from "zod";
9993
- import { Timestamp as Timestamp19 } from "firebase/firestore";
10408
+ import { Timestamp as Timestamp20 } from "firebase/firestore";
9994
10409
  var clinicInfoSchema2 = z22.object({
9995
10410
  id: z22.string(),
9996
10411
  featuredPhoto: z22.string(),
@@ -10012,19 +10427,19 @@ var patientProfileInfoSchema = z22.object({
10012
10427
  fullName: z22.string(),
10013
10428
  email: z22.string().email(),
10014
10429
  phone: z22.string().nullable(),
10015
- dateOfBirth: z22.instanceof(Timestamp19),
10430
+ dateOfBirth: z22.instanceof(Timestamp20),
10016
10431
  gender: z22.nativeEnum(Gender)
10017
10432
  });
10018
10433
 
10019
10434
  // src/validations/calendar.schema.ts
10020
10435
  var MIN_APPOINTMENT_DURATION = 15;
10021
10436
  var calendarEventTimeSchema = z23.object({
10022
- start: z23.instanceof(Date).or(z23.instanceof(Timestamp20)),
10023
- end: z23.instanceof(Date).or(z23.instanceof(Timestamp20))
10437
+ start: z23.instanceof(Date).or(z23.instanceof(Timestamp21)),
10438
+ end: z23.instanceof(Date).or(z23.instanceof(Timestamp21))
10024
10439
  }).refine(
10025
10440
  (data) => {
10026
- const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
10027
- const endDate = data.end instanceof Timestamp20 ? data.end.toDate() : data.end;
10441
+ const startDate = data.start instanceof Timestamp21 ? data.start.toDate() : data.start;
10442
+ const endDate = data.end instanceof Timestamp21 ? data.end.toDate() : data.end;
10028
10443
  return startDate < endDate;
10029
10444
  },
10030
10445
  {
@@ -10033,7 +10448,7 @@ var calendarEventTimeSchema = z23.object({
10033
10448
  }
10034
10449
  ).refine(
10035
10450
  (data) => {
10036
- const startDate = data.start instanceof Timestamp20 ? data.start.toDate() : data.start;
10451
+ const startDate = data.start instanceof Timestamp21 ? data.start.toDate() : data.start;
10037
10452
  return startDate > /* @__PURE__ */ new Date();
10038
10453
  },
10039
10454
  {
@@ -10052,7 +10467,7 @@ var timeSlotSchema2 = z23.object({
10052
10467
  var syncedCalendarEventSchema = z23.object({
10053
10468
  eventId: z23.string(),
10054
10469
  syncedCalendarProvider: z23.nativeEnum(SyncedCalendarProvider),
10055
- syncedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp20))
10470
+ syncedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21))
10056
10471
  });
10057
10472
  var procedureInfoSchema = z23.object({
10058
10473
  name: z23.string(),
@@ -10154,60 +10569,60 @@ var calendarEventSchema = z23.object({
10154
10569
  status: z23.nativeEnum(CalendarEventStatus),
10155
10570
  syncStatus: z23.nativeEnum(CalendarSyncStatus),
10156
10571
  eventType: z23.nativeEnum(CalendarEventType),
10157
- createdAt: z23.instanceof(Date).or(z23.instanceof(Timestamp20)),
10158
- updatedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp20))
10572
+ createdAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21)),
10573
+ updatedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21))
10159
10574
  });
10160
10575
 
10161
10576
  // src/services/calendar/utils/clinic.utils.ts
10162
10577
  import {
10163
- collection as collection19,
10164
- doc as doc20,
10165
- getDoc as getDoc22,
10166
- getDocs as getDocs19,
10167
- setDoc as setDoc17,
10168
- updateDoc as updateDoc19,
10169
- deleteDoc as deleteDoc11,
10170
- query as query19,
10171
- where as where19,
10172
- orderBy as orderBy8,
10173
- Timestamp as Timestamp21,
10174
- serverTimestamp as serverTimestamp16
10578
+ collection as collection20,
10579
+ doc as doc21,
10580
+ getDoc as getDoc23,
10581
+ getDocs as getDocs20,
10582
+ setDoc as setDoc18,
10583
+ updateDoc as updateDoc20,
10584
+ deleteDoc as deleteDoc12,
10585
+ query as query20,
10586
+ where as where20,
10587
+ orderBy as orderBy9,
10588
+ Timestamp as Timestamp22,
10589
+ serverTimestamp as serverTimestamp17
10175
10590
  } from "firebase/firestore";
10176
10591
 
10177
10592
  // src/services/calendar/utils/docs.utils.ts
10178
- import { doc as doc19 } from "firebase/firestore";
10593
+ import { doc as doc20 } from "firebase/firestore";
10179
10594
  function getPractitionerCalendarEventDocRef(db, practitionerId, eventId) {
10180
- return doc19(
10595
+ return doc20(
10181
10596
  db,
10182
10597
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/${CALENDAR_COLLECTION}/${eventId}`
10183
10598
  );
10184
10599
  }
10185
10600
  function getPatientCalendarEventDocRef(db, patientId, eventId) {
10186
- return doc19(
10601
+ return doc20(
10187
10602
  db,
10188
10603
  `${PATIENTS_COLLECTION}/${patientId}/${CALENDAR_COLLECTION}/${eventId}`
10189
10604
  );
10190
10605
  }
10191
10606
  function getClinicCalendarEventDocRef(db, clinicId, eventId) {
10192
- return doc19(
10607
+ return doc20(
10193
10608
  db,
10194
10609
  `${CLINICS_COLLECTION}/${clinicId}/${CALENDAR_COLLECTION}/${eventId}`
10195
10610
  );
10196
10611
  }
10197
10612
  function getPractitionerSyncedCalendarDocRef(db, practitionerId, syncedCalendarId) {
10198
- return doc19(
10613
+ return doc20(
10199
10614
  db,
10200
10615
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/syncedCalendars/${syncedCalendarId}`
10201
10616
  );
10202
10617
  }
10203
10618
  function getPatientSyncedCalendarDocRef(db, patientId, syncedCalendarId) {
10204
- return doc19(
10619
+ return doc20(
10205
10620
  db,
10206
10621
  `${PATIENTS_COLLECTION}/${patientId}/syncedCalendars/${syncedCalendarId}`
10207
10622
  );
10208
10623
  }
10209
10624
  function getClinicSyncedCalendarDocRef(db, clinicId, syncedCalendarId) {
10210
- return doc19(
10625
+ return doc20(
10211
10626
  db,
10212
10627
  `${CLINICS_COLLECTION}/${clinicId}/syncedCalendars/${syncedCalendarId}`
10213
10628
  );
@@ -10220,31 +10635,31 @@ async function createClinicCalendarEventUtil(db, clinicId, eventData, generateId
10220
10635
  const newEvent = {
10221
10636
  id: eventId,
10222
10637
  ...eventData,
10223
- createdAt: serverTimestamp16(),
10224
- updatedAt: serverTimestamp16()
10638
+ createdAt: serverTimestamp17(),
10639
+ updatedAt: serverTimestamp17()
10225
10640
  };
10226
- await setDoc17(eventRef, newEvent);
10641
+ await setDoc18(eventRef, newEvent);
10227
10642
  return {
10228
10643
  ...newEvent,
10229
- createdAt: Timestamp21.now(),
10230
- updatedAt: Timestamp21.now()
10644
+ createdAt: Timestamp22.now(),
10645
+ updatedAt: Timestamp22.now()
10231
10646
  };
10232
10647
  }
10233
10648
  async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData) {
10234
10649
  const eventRef = getClinicCalendarEventDocRef(db, clinicId, eventId);
10235
10650
  const updates = {
10236
10651
  ...updateData,
10237
- updatedAt: serverTimestamp16()
10652
+ updatedAt: serverTimestamp17()
10238
10653
  };
10239
- await updateDoc19(eventRef, updates);
10240
- const updatedDoc = await getDoc22(eventRef);
10654
+ await updateDoc20(eventRef, updates);
10655
+ const updatedDoc = await getDoc23(eventRef);
10241
10656
  if (!updatedDoc.exists()) {
10242
10657
  throw new Error("Event not found after update");
10243
10658
  }
10244
10659
  return updatedDoc.data();
10245
10660
  }
10246
10661
  async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
10247
- const clinicDoc = await getDoc22(doc20(db, `clinics/${clinicId}`));
10662
+ const clinicDoc = await getDoc23(doc21(db, `clinics/${clinicId}`));
10248
10663
  if (!clinicDoc.exists()) {
10249
10664
  throw new Error(`Clinic with ID ${clinicId} not found`);
10250
10665
  }
@@ -10253,8 +10668,8 @@ async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
10253
10668
  if (!clinicGroupId) {
10254
10669
  return false;
10255
10670
  }
10256
- const clinicGroupDoc = await getDoc22(
10257
- doc20(db, `${CLINIC_GROUPS_COLLECTION}/${clinicGroupId}`)
10671
+ const clinicGroupDoc = await getDoc23(
10672
+ doc21(db, `${CLINIC_GROUPS_COLLECTION}/${clinicGroupId}`)
10258
10673
  );
10259
10674
  if (!clinicGroupDoc.exists()) {
10260
10675
  return false;
@@ -10265,17 +10680,17 @@ async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
10265
10680
 
10266
10681
  // src/services/calendar/utils/patient.utils.ts
10267
10682
  import {
10268
- collection as collection20,
10269
- getDoc as getDoc23,
10270
- getDocs as getDocs20,
10271
- setDoc as setDoc18,
10272
- updateDoc as updateDoc20,
10273
- deleteDoc as deleteDoc12,
10274
- query as query20,
10275
- where as where20,
10276
- orderBy as orderBy9,
10277
- Timestamp as Timestamp22,
10278
- serverTimestamp as serverTimestamp17
10683
+ collection as collection21,
10684
+ getDoc as getDoc24,
10685
+ getDocs as getDocs21,
10686
+ setDoc as setDoc19,
10687
+ updateDoc as updateDoc21,
10688
+ deleteDoc as deleteDoc13,
10689
+ query as query21,
10690
+ where as where21,
10691
+ orderBy as orderBy10,
10692
+ Timestamp as Timestamp23,
10693
+ serverTimestamp as serverTimestamp18
10279
10694
  } from "firebase/firestore";
10280
10695
  async function createPatientCalendarEventUtil(db, patientId, eventData, generateId2) {
10281
10696
  const eventId = generateId2();
@@ -10283,24 +10698,24 @@ async function createPatientCalendarEventUtil(db, patientId, eventData, generate
10283
10698
  const newEvent = {
10284
10699
  id: eventId,
10285
10700
  ...eventData,
10286
- createdAt: serverTimestamp17(),
10287
- updatedAt: serverTimestamp17()
10701
+ createdAt: serverTimestamp18(),
10702
+ updatedAt: serverTimestamp18()
10288
10703
  };
10289
- await setDoc18(eventRef, newEvent);
10704
+ await setDoc19(eventRef, newEvent);
10290
10705
  return {
10291
10706
  ...newEvent,
10292
- createdAt: Timestamp22.now(),
10293
- updatedAt: Timestamp22.now()
10707
+ createdAt: Timestamp23.now(),
10708
+ updatedAt: Timestamp23.now()
10294
10709
  };
10295
10710
  }
10296
10711
  async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData) {
10297
10712
  const eventRef = getPatientCalendarEventDocRef(db, patientId, eventId);
10298
10713
  const updates = {
10299
10714
  ...updateData,
10300
- updatedAt: serverTimestamp17()
10715
+ updatedAt: serverTimestamp18()
10301
10716
  };
10302
- await updateDoc20(eventRef, updates);
10303
- const updatedDoc = await getDoc23(eventRef);
10717
+ await updateDoc21(eventRef, updates);
10718
+ const updatedDoc = await getDoc24(eventRef);
10304
10719
  if (!updatedDoc.exists()) {
10305
10720
  throw new Error("Event not found after update");
10306
10721
  }
@@ -10309,17 +10724,17 @@ async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData
10309
10724
 
10310
10725
  // src/services/calendar/utils/practitioner.utils.ts
10311
10726
  import {
10312
- collection as collection21,
10313
- getDoc as getDoc24,
10314
- getDocs as getDocs21,
10315
- setDoc as setDoc19,
10316
- updateDoc as updateDoc21,
10317
- deleteDoc as deleteDoc13,
10318
- query as query21,
10319
- where as where21,
10320
- orderBy as orderBy10,
10321
- Timestamp as Timestamp23,
10322
- serverTimestamp as serverTimestamp18
10727
+ collection as collection22,
10728
+ getDoc as getDoc25,
10729
+ getDocs as getDocs22,
10730
+ setDoc as setDoc20,
10731
+ updateDoc as updateDoc22,
10732
+ deleteDoc as deleteDoc14,
10733
+ query as query22,
10734
+ where as where22,
10735
+ orderBy as orderBy11,
10736
+ Timestamp as Timestamp24,
10737
+ serverTimestamp as serverTimestamp19
10323
10738
  } from "firebase/firestore";
10324
10739
  async function createPractitionerCalendarEventUtil(db, practitionerId, eventData, generateId2) {
10325
10740
  const eventId = generateId2();
@@ -10331,14 +10746,14 @@ async function createPractitionerCalendarEventUtil(db, practitionerId, eventData
10331
10746
  const newEvent = {
10332
10747
  id: eventId,
10333
10748
  ...eventData,
10334
- createdAt: serverTimestamp18(),
10335
- updatedAt: serverTimestamp18()
10749
+ createdAt: serverTimestamp19(),
10750
+ updatedAt: serverTimestamp19()
10336
10751
  };
10337
- await setDoc19(eventRef, newEvent);
10752
+ await setDoc20(eventRef, newEvent);
10338
10753
  return {
10339
10754
  ...newEvent,
10340
- createdAt: Timestamp23.now(),
10341
- updatedAt: Timestamp23.now()
10755
+ createdAt: Timestamp24.now(),
10756
+ updatedAt: Timestamp24.now()
10342
10757
  };
10343
10758
  }
10344
10759
  async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId, updateData) {
@@ -10349,10 +10764,10 @@ async function updatePractitionerCalendarEventUtil(db, practitionerId, eventId,
10349
10764
  );
10350
10765
  const updates = {
10351
10766
  ...updateData,
10352
- updatedAt: serverTimestamp18()
10767
+ updatedAt: serverTimestamp19()
10353
10768
  };
10354
- await updateDoc21(eventRef, updates);
10355
- const updatedDoc = await getDoc24(eventRef);
10769
+ await updateDoc22(eventRef, updates);
10770
+ const updatedDoc = await getDoc25(eventRef);
10356
10771
  if (!updatedDoc.exists()) {
10357
10772
  throw new Error("Event not found after update");
10358
10773
  }
@@ -10411,18 +10826,18 @@ async function updateAppointmentUtil(db, clinicId, practitionerId, patientId, ev
10411
10826
 
10412
10827
  // src/services/calendar/utils/calendar-event.utils.ts
10413
10828
  import {
10414
- collection as collection22,
10415
- doc as doc23,
10416
- getDoc as getDoc25,
10417
- getDocs as getDocs22,
10418
- setDoc as setDoc20,
10419
- updateDoc as updateDoc22,
10420
- deleteDoc as deleteDoc14,
10421
- query as query22,
10422
- where as where22,
10423
- orderBy as orderBy11,
10424
- Timestamp as Timestamp24,
10425
- serverTimestamp as serverTimestamp19
10829
+ collection as collection23,
10830
+ doc as doc24,
10831
+ getDoc as getDoc26,
10832
+ getDocs as getDocs23,
10833
+ setDoc as setDoc21,
10834
+ updateDoc as updateDoc23,
10835
+ deleteDoc as deleteDoc15,
10836
+ query as query23,
10837
+ where as where23,
10838
+ orderBy as orderBy12,
10839
+ Timestamp as Timestamp25,
10840
+ serverTimestamp as serverTimestamp20
10426
10841
  } from "firebase/firestore";
10427
10842
  async function searchCalendarEventsUtil(db, params) {
10428
10843
  const { searchLocation, entityId, ...filters } = params;
@@ -10466,7 +10881,7 @@ async function searchCalendarEventsUtil(db, params) {
10466
10881
  );
10467
10882
  }
10468
10883
  baseCollectionPath = `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
10469
- constraints.push(where22("clinicBranchId", "==", entityId));
10884
+ constraints.push(where23("clinicBranchId", "==", entityId));
10470
10885
  if (filters.clinicId && filters.clinicId !== entityId) {
10471
10886
  console.warn(
10472
10887
  `Provided clinicId filter (${filters.clinicId}) does not match search entityId (${entityId}). Returning empty results.`
@@ -10478,36 +10893,36 @@ async function searchCalendarEventsUtil(db, params) {
10478
10893
  default:
10479
10894
  throw new Error(`Invalid search location: ${searchLocation}`);
10480
10895
  }
10481
- const collectionRef = collection22(db, baseCollectionPath);
10896
+ const collectionRef = collection23(db, baseCollectionPath);
10482
10897
  if (filters.clinicId) {
10483
- constraints.push(where22("clinicBranchId", "==", filters.clinicId));
10898
+ constraints.push(where23("clinicBranchId", "==", filters.clinicId));
10484
10899
  }
10485
10900
  if (filters.practitionerId) {
10486
10901
  constraints.push(
10487
- where22("practitionerProfileId", "==", filters.practitionerId)
10902
+ where23("practitionerProfileId", "==", filters.practitionerId)
10488
10903
  );
10489
10904
  }
10490
10905
  if (filters.patientId) {
10491
- constraints.push(where22("patientProfileId", "==", filters.patientId));
10906
+ constraints.push(where23("patientProfileId", "==", filters.patientId));
10492
10907
  }
10493
10908
  if (filters.procedureId) {
10494
- constraints.push(where22("procedureId", "==", filters.procedureId));
10909
+ constraints.push(where23("procedureId", "==", filters.procedureId));
10495
10910
  }
10496
10911
  if (filters.eventStatus) {
10497
- constraints.push(where22("status", "==", filters.eventStatus));
10912
+ constraints.push(where23("status", "==", filters.eventStatus));
10498
10913
  }
10499
10914
  if (filters.eventType) {
10500
- constraints.push(where22("eventType", "==", filters.eventType));
10915
+ constraints.push(where23("eventType", "==", filters.eventType));
10501
10916
  }
10502
10917
  if (filters.dateRange) {
10503
- constraints.push(where22("eventTime.start", ">=", filters.dateRange.start));
10504
- constraints.push(where22("eventTime.start", "<=", filters.dateRange.end));
10918
+ constraints.push(where23("eventTime.start", ">=", filters.dateRange.start));
10919
+ constraints.push(where23("eventTime.start", "<=", filters.dateRange.end));
10505
10920
  }
10506
10921
  try {
10507
- const finalQuery = query22(collectionRef, ...constraints);
10508
- const querySnapshot = await getDocs22(finalQuery);
10922
+ const finalQuery = query23(collectionRef, ...constraints);
10923
+ const querySnapshot = await getDocs23(finalQuery);
10509
10924
  const events = querySnapshot.docs.map(
10510
- (doc34) => ({ id: doc34.id, ...doc34.data() })
10925
+ (doc35) => ({ id: doc35.id, ...doc35.data() })
10511
10926
  );
10512
10927
  return events;
10513
10928
  } catch (error) {
@@ -10518,16 +10933,16 @@ async function searchCalendarEventsUtil(db, params) {
10518
10933
 
10519
10934
  // src/services/calendar/utils/synced-calendar.utils.ts
10520
10935
  import {
10521
- collection as collection23,
10522
- getDoc as getDoc26,
10523
- getDocs as getDocs23,
10524
- setDoc as setDoc21,
10525
- updateDoc as updateDoc23,
10526
- deleteDoc as deleteDoc15,
10527
- query as query23,
10528
- orderBy as orderBy12,
10529
- Timestamp as Timestamp25,
10530
- serverTimestamp as serverTimestamp20
10936
+ collection as collection24,
10937
+ getDoc as getDoc27,
10938
+ getDocs as getDocs24,
10939
+ setDoc as setDoc22,
10940
+ updateDoc as updateDoc24,
10941
+ deleteDoc as deleteDoc16,
10942
+ query as query24,
10943
+ orderBy as orderBy13,
10944
+ Timestamp as Timestamp26,
10945
+ serverTimestamp as serverTimestamp21
10531
10946
  } from "firebase/firestore";
10532
10947
  async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendarData, generateId2) {
10533
10948
  const calendarId = generateId2();
@@ -10539,14 +10954,14 @@ async function createPractitionerSyncedCalendarUtil(db, practitionerId, calendar
10539
10954
  const newCalendar = {
10540
10955
  id: calendarId,
10541
10956
  ...calendarData,
10542
- createdAt: serverTimestamp20(),
10543
- updatedAt: serverTimestamp20()
10957
+ createdAt: serverTimestamp21(),
10958
+ updatedAt: serverTimestamp21()
10544
10959
  };
10545
- await setDoc21(calendarRef, newCalendar);
10960
+ await setDoc22(calendarRef, newCalendar);
10546
10961
  return {
10547
10962
  ...newCalendar,
10548
- createdAt: Timestamp25.now(),
10549
- updatedAt: Timestamp25.now()
10963
+ createdAt: Timestamp26.now(),
10964
+ updatedAt: Timestamp26.now()
10550
10965
  };
10551
10966
  }
10552
10967
  async function createPatientSyncedCalendarUtil(db, patientId, calendarData, generateId2) {
@@ -10555,14 +10970,14 @@ async function createPatientSyncedCalendarUtil(db, patientId, calendarData, gene
10555
10970
  const newCalendar = {
10556
10971
  id: calendarId,
10557
10972
  ...calendarData,
10558
- createdAt: serverTimestamp20(),
10559
- updatedAt: serverTimestamp20()
10973
+ createdAt: serverTimestamp21(),
10974
+ updatedAt: serverTimestamp21()
10560
10975
  };
10561
- await setDoc21(calendarRef, newCalendar);
10976
+ await setDoc22(calendarRef, newCalendar);
10562
10977
  return {
10563
10978
  ...newCalendar,
10564
- createdAt: Timestamp25.now(),
10565
- updatedAt: Timestamp25.now()
10979
+ createdAt: Timestamp26.now(),
10980
+ updatedAt: Timestamp26.now()
10566
10981
  };
10567
10982
  }
10568
10983
  async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, generateId2) {
@@ -10571,14 +10986,14 @@ async function createClinicSyncedCalendarUtil(db, clinicId, calendarData, genera
10571
10986
  const newCalendar = {
10572
10987
  id: calendarId,
10573
10988
  ...calendarData,
10574
- createdAt: serverTimestamp20(),
10575
- updatedAt: serverTimestamp20()
10989
+ createdAt: serverTimestamp21(),
10990
+ updatedAt: serverTimestamp21()
10576
10991
  };
10577
- await setDoc21(calendarRef, newCalendar);
10992
+ await setDoc22(calendarRef, newCalendar);
10578
10993
  return {
10579
10994
  ...newCalendar,
10580
- createdAt: Timestamp25.now(),
10581
- updatedAt: Timestamp25.now()
10995
+ createdAt: Timestamp26.now(),
10996
+ updatedAt: Timestamp26.now()
10582
10997
  };
10583
10998
  }
10584
10999
  async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId) {
@@ -10587,54 +11002,54 @@ async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId)
10587
11002
  practitionerId,
10588
11003
  calendarId
10589
11004
  );
10590
- const calendarDoc = await getDoc26(calendarRef);
11005
+ const calendarDoc = await getDoc27(calendarRef);
10591
11006
  if (!calendarDoc.exists()) {
10592
11007
  return null;
10593
11008
  }
10594
11009
  return calendarDoc.data();
10595
11010
  }
10596
11011
  async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
10597
- const calendarsRef = collection23(
11012
+ const calendarsRef = collection24(
10598
11013
  db,
10599
11014
  `practitioners/${practitionerId}/${SYNCED_CALENDARS_COLLECTION}`
10600
11015
  );
10601
- const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
10602
- const querySnapshot = await getDocs23(q);
10603
- return querySnapshot.docs.map((doc34) => doc34.data());
11016
+ const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11017
+ const querySnapshot = await getDocs24(q);
11018
+ return querySnapshot.docs.map((doc35) => doc35.data());
10604
11019
  }
10605
11020
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
10606
11021
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
10607
- const calendarDoc = await getDoc26(calendarRef);
11022
+ const calendarDoc = await getDoc27(calendarRef);
10608
11023
  if (!calendarDoc.exists()) {
10609
11024
  return null;
10610
11025
  }
10611
11026
  return calendarDoc.data();
10612
11027
  }
10613
11028
  async function getPatientSyncedCalendarsUtil(db, patientId) {
10614
- const calendarsRef = collection23(
11029
+ const calendarsRef = collection24(
10615
11030
  db,
10616
11031
  `patients/${patientId}/${SYNCED_CALENDARS_COLLECTION}`
10617
11032
  );
10618
- const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
10619
- const querySnapshot = await getDocs23(q);
10620
- return querySnapshot.docs.map((doc34) => doc34.data());
11033
+ const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11034
+ const querySnapshot = await getDocs24(q);
11035
+ return querySnapshot.docs.map((doc35) => doc35.data());
10621
11036
  }
10622
11037
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
10623
11038
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
10624
- const calendarDoc = await getDoc26(calendarRef);
11039
+ const calendarDoc = await getDoc27(calendarRef);
10625
11040
  if (!calendarDoc.exists()) {
10626
11041
  return null;
10627
11042
  }
10628
11043
  return calendarDoc.data();
10629
11044
  }
10630
11045
  async function getClinicSyncedCalendarsUtil(db, clinicId) {
10631
- const calendarsRef = collection23(
11046
+ const calendarsRef = collection24(
10632
11047
  db,
10633
11048
  `clinics/${clinicId}/${SYNCED_CALENDARS_COLLECTION}`
10634
11049
  );
10635
- const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
10636
- const querySnapshot = await getDocs23(q);
10637
- return querySnapshot.docs.map((doc34) => doc34.data());
11050
+ const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11051
+ const querySnapshot = await getDocs24(q);
11052
+ return querySnapshot.docs.map((doc35) => doc35.data());
10638
11053
  }
10639
11054
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
10640
11055
  const calendarRef = getPractitionerSyncedCalendarDocRef(
@@ -10644,10 +11059,10 @@ async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendar
10644
11059
  );
10645
11060
  const updates = {
10646
11061
  ...updateData,
10647
- updatedAt: serverTimestamp20()
11062
+ updatedAt: serverTimestamp21()
10648
11063
  };
10649
- await updateDoc23(calendarRef, updates);
10650
- const updatedDoc = await getDoc26(calendarRef);
11064
+ await updateDoc24(calendarRef, updates);
11065
+ const updatedDoc = await getDoc27(calendarRef);
10651
11066
  if (!updatedDoc.exists()) {
10652
11067
  throw new Error("Synced calendar not found after update");
10653
11068
  }
@@ -10657,10 +11072,10 @@ async function updatePatientSyncedCalendarUtil(db, patientId, calendarId, update
10657
11072
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
10658
11073
  const updates = {
10659
11074
  ...updateData,
10660
- updatedAt: serverTimestamp20()
11075
+ updatedAt: serverTimestamp21()
10661
11076
  };
10662
- await updateDoc23(calendarRef, updates);
10663
- const updatedDoc = await getDoc26(calendarRef);
11077
+ await updateDoc24(calendarRef, updates);
11078
+ const updatedDoc = await getDoc27(calendarRef);
10664
11079
  if (!updatedDoc.exists()) {
10665
11080
  throw new Error("Synced calendar not found after update");
10666
11081
  }
@@ -10670,10 +11085,10 @@ async function updateClinicSyncedCalendarUtil(db, clinicId, calendarId, updateDa
10670
11085
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
10671
11086
  const updates = {
10672
11087
  ...updateData,
10673
- updatedAt: serverTimestamp20()
11088
+ updatedAt: serverTimestamp21()
10674
11089
  };
10675
- await updateDoc23(calendarRef, updates);
10676
- const updatedDoc = await getDoc26(calendarRef);
11090
+ await updateDoc24(calendarRef, updates);
11091
+ const updatedDoc = await getDoc27(calendarRef);
10677
11092
  if (!updatedDoc.exists()) {
10678
11093
  throw new Error("Synced calendar not found after update");
10679
11094
  }
@@ -10685,19 +11100,19 @@ async function deletePractitionerSyncedCalendarUtil(db, practitionerId, calendar
10685
11100
  practitionerId,
10686
11101
  calendarId
10687
11102
  );
10688
- await deleteDoc15(calendarRef);
11103
+ await deleteDoc16(calendarRef);
10689
11104
  }
10690
11105
  async function deletePatientSyncedCalendarUtil(db, patientId, calendarId) {
10691
11106
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
10692
- await deleteDoc15(calendarRef);
11107
+ await deleteDoc16(calendarRef);
10693
11108
  }
10694
11109
  async function deleteClinicSyncedCalendarUtil(db, clinicId, calendarId) {
10695
11110
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
10696
- await deleteDoc15(calendarRef);
11111
+ await deleteDoc16(calendarRef);
10697
11112
  }
10698
11113
  async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarId) {
10699
11114
  const updateData = {
10700
- lastSyncedAt: Timestamp25.now()
11115
+ lastSyncedAt: Timestamp26.now()
10701
11116
  };
10702
11117
  switch (entityType) {
10703
11118
  case "practitioner":
@@ -10727,7 +11142,7 @@ async function updateLastSyncedTimestampUtil(db, entityType, entityId, calendarI
10727
11142
  }
10728
11143
 
10729
11144
  // src/services/calendar/utils/google-calendar.utils.ts
10730
- import { Timestamp as Timestamp26 } from "firebase/firestore";
11145
+ import { Timestamp as Timestamp27 } from "firebase/firestore";
10731
11146
  var GOOGLE_CALENDAR_API_URL = "https://www.googleapis.com/calendar/v3";
10732
11147
  var GOOGLE_OAUTH_URL = "https://oauth2.googleapis.com/token";
10733
11148
  var CLIENT_ID = "your-client-id";
@@ -10847,7 +11262,7 @@ async function ensureValidToken(db, entityType, entityId, syncedCalendar) {
10847
11262
  tokenExpiry.setSeconds(tokenExpiry.getSeconds() + expiresIn);
10848
11263
  const updateData = {
10849
11264
  accessToken,
10850
- tokenExpiry: Timestamp26.fromDate(tokenExpiry)
11265
+ tokenExpiry: Timestamp27.fromDate(tokenExpiry)
10851
11266
  };
10852
11267
  switch (entityType) {
10853
11268
  case "practitioner":
@@ -11022,8 +11437,8 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
11022
11437
  eventName: googleEvent.summary || "External Event",
11023
11438
  eventLocation: googleEvent.location,
11024
11439
  eventTime: {
11025
- start: Timestamp26.fromDate(start),
11026
- end: Timestamp26.fromDate(end)
11440
+ start: Timestamp27.fromDate(start),
11441
+ end: Timestamp27.fromDate(end)
11027
11442
  },
11028
11443
  description: googleEvent.description || "",
11029
11444
  // External events are always set as CONFIRMED - status updates will happen externally
@@ -11037,7 +11452,7 @@ function convertGoogleEventToCalendarEventUtil(googleEvent, entityId, entityType
11037
11452
  {
11038
11453
  eventId: googleEvent.id,
11039
11454
  syncedCalendarProvider: "google" /* GOOGLE */,
11040
- syncedAt: Timestamp26.now()
11455
+ syncedAt: Timestamp27.now()
11041
11456
  }
11042
11457
  ]
11043
11458
  };
@@ -11815,7 +12230,7 @@ var CalendarServiceV2 = class extends BaseService {
11815
12230
  return 0;
11816
12231
  }
11817
12232
  let importedEventsCount = 0;
11818
- const currentTime = Timestamp27.now();
12233
+ const currentTime = Timestamp28.now();
11819
12234
  for (const calendar of activeCalendars) {
11820
12235
  try {
11821
12236
  let externalEvents = [];
@@ -11882,7 +12297,7 @@ var CalendarServiceV2 = class extends BaseService {
11882
12297
  async createDoctorBlockingEvent(doctorId, eventData) {
11883
12298
  try {
11884
12299
  const eventId = this.generateId();
11885
- const eventRef = doc25(
12300
+ const eventRef = doc26(
11886
12301
  this.db,
11887
12302
  PRACTITIONERS_COLLECTION,
11888
12303
  doctorId,
@@ -11892,14 +12307,14 @@ var CalendarServiceV2 = class extends BaseService {
11892
12307
  const newEvent = {
11893
12308
  id: eventId,
11894
12309
  ...eventData,
11895
- createdAt: serverTimestamp21(),
11896
- updatedAt: serverTimestamp21()
12310
+ createdAt: serverTimestamp22(),
12311
+ updatedAt: serverTimestamp22()
11897
12312
  };
11898
- await setDoc22(eventRef, newEvent);
12313
+ await setDoc23(eventRef, newEvent);
11899
12314
  return {
11900
12315
  ...newEvent,
11901
- createdAt: Timestamp27.now(),
11902
- updatedAt: Timestamp27.now()
12316
+ createdAt: Timestamp28.now(),
12317
+ updatedAt: Timestamp28.now()
11903
12318
  };
11904
12319
  } catch (error) {
11905
12320
  console.error(
@@ -11917,8 +12332,8 @@ var CalendarServiceV2 = class extends BaseService {
11917
12332
  */
11918
12333
  async synchronizeExternalCalendars(lookbackDays = 7, lookforwardDays = 30) {
11919
12334
  try {
11920
- const practitionersRef = collection24(this.db, PRACTITIONERS_COLLECTION);
11921
- const practitionersSnapshot = await getDocs24(practitionersRef);
12335
+ const practitionersRef = collection25(this.db, PRACTITIONERS_COLLECTION);
12336
+ const practitionersSnapshot = await getDocs25(practitionersRef);
11922
12337
  const startDate = /* @__PURE__ */ new Date();
11923
12338
  startDate.setDate(startDate.getDate() - lookbackDays);
11924
12339
  const endDate = /* @__PURE__ */ new Date();
@@ -11976,22 +12391,22 @@ var CalendarServiceV2 = class extends BaseService {
11976
12391
  async updateExistingEventsFromExternalCalendars(doctorId, startDate, endDate) {
11977
12392
  var _a;
11978
12393
  try {
11979
- const eventsRef = collection24(
12394
+ const eventsRef = collection25(
11980
12395
  this.db,
11981
12396
  PRACTITIONERS_COLLECTION,
11982
12397
  doctorId,
11983
12398
  CALENDAR_COLLECTION
11984
12399
  );
11985
- const q = query24(
12400
+ const q = query25(
11986
12401
  eventsRef,
11987
- where24("syncStatus", "==", "external" /* EXTERNAL */),
11988
- where24("eventTime.start", ">=", Timestamp27.fromDate(startDate)),
11989
- where24("eventTime.start", "<=", Timestamp27.fromDate(endDate))
11990
- );
11991
- const eventsSnapshot = await getDocs24(q);
11992
- const events = eventsSnapshot.docs.map((doc34) => ({
11993
- id: doc34.id,
11994
- ...doc34.data()
12402
+ where25("syncStatus", "==", "external" /* EXTERNAL */),
12403
+ where25("eventTime.start", ">=", Timestamp28.fromDate(startDate)),
12404
+ where25("eventTime.start", "<=", Timestamp28.fromDate(endDate))
12405
+ );
12406
+ const eventsSnapshot = await getDocs25(q);
12407
+ const events = eventsSnapshot.docs.map((doc35) => ({
12408
+ id: doc35.id,
12409
+ ...doc35.data()
11995
12410
  }));
11996
12411
  const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
11997
12412
  doctorId
@@ -12095,21 +12510,21 @@ var CalendarServiceV2 = class extends BaseService {
12095
12510
  const endTime = new Date(
12096
12511
  externalEvent.end.dateTime || externalEvent.end.date
12097
12512
  );
12098
- const eventRef = doc25(
12513
+ const eventRef = doc26(
12099
12514
  this.db,
12100
12515
  PRACTITIONERS_COLLECTION,
12101
12516
  doctorId,
12102
12517
  CALENDAR_COLLECTION,
12103
12518
  eventId
12104
12519
  );
12105
- await updateDoc24(eventRef, {
12520
+ await updateDoc25(eventRef, {
12106
12521
  eventName: externalEvent.summary || "External Event",
12107
12522
  eventTime: {
12108
- start: Timestamp27.fromDate(startTime),
12109
- end: Timestamp27.fromDate(endTime)
12523
+ start: Timestamp28.fromDate(startTime),
12524
+ end: Timestamp28.fromDate(endTime)
12110
12525
  },
12111
12526
  description: externalEvent.description || "",
12112
- updatedAt: serverTimestamp21()
12527
+ updatedAt: serverTimestamp22()
12113
12528
  });
12114
12529
  console.log(`Updated local event ${eventId} from external event`);
12115
12530
  } catch (error) {
@@ -12127,16 +12542,16 @@ var CalendarServiceV2 = class extends BaseService {
12127
12542
  */
12128
12543
  async updateEventStatus(doctorId, eventId, status) {
12129
12544
  try {
12130
- const eventRef = doc25(
12545
+ const eventRef = doc26(
12131
12546
  this.db,
12132
12547
  PRACTITIONERS_COLLECTION,
12133
12548
  doctorId,
12134
12549
  CALENDAR_COLLECTION,
12135
12550
  eventId
12136
12551
  );
12137
- await updateDoc24(eventRef, {
12552
+ await updateDoc25(eventRef, {
12138
12553
  status,
12139
- updatedAt: serverTimestamp21()
12554
+ updatedAt: serverTimestamp22()
12140
12555
  });
12141
12556
  console.log(`Updated event ${eventId} status to ${status}`);
12142
12557
  } catch (error) {
@@ -12184,8 +12599,8 @@ var CalendarServiceV2 = class extends BaseService {
12184
12599
  */
12185
12600
  async getPractitionerUpcomingAppointments(doctorId, startDate, endDate, status = "confirmed" /* CONFIRMED */) {
12186
12601
  const dateRange = {
12187
- start: Timestamp27.fromDate(startDate),
12188
- end: Timestamp27.fromDate(endDate)
12602
+ start: Timestamp28.fromDate(startDate),
12603
+ end: Timestamp28.fromDate(endDate)
12189
12604
  };
12190
12605
  const searchParams = {
12191
12606
  searchLocation: "practitioner" /* PRACTITIONER */,
@@ -12207,8 +12622,8 @@ var CalendarServiceV2 = class extends BaseService {
12207
12622
  */
12208
12623
  async getPatientAppointments(patientId, startDate, endDate, status) {
12209
12624
  const dateRange = {
12210
- start: Timestamp27.fromDate(startDate),
12211
- end: Timestamp27.fromDate(endDate)
12625
+ start: Timestamp28.fromDate(startDate),
12626
+ end: Timestamp28.fromDate(endDate)
12212
12627
  };
12213
12628
  const searchParams = {
12214
12629
  searchLocation: "patient" /* PATIENT */,
@@ -12233,8 +12648,8 @@ var CalendarServiceV2 = class extends BaseService {
12233
12648
  */
12234
12649
  async getClinicAppointments(clinicId, startDate, endDate, doctorId, status) {
12235
12650
  const dateRange = {
12236
- start: Timestamp27.fromDate(startDate),
12237
- end: Timestamp27.fromDate(endDate)
12651
+ start: Timestamp28.fromDate(startDate),
12652
+ end: Timestamp28.fromDate(endDate)
12238
12653
  };
12239
12654
  const searchParams = {
12240
12655
  searchLocation: "clinic" /* CLINIC */,
@@ -12293,8 +12708,8 @@ var CalendarServiceV2 = class extends BaseService {
12293
12708
  const startDate = eventTime.start.toDate();
12294
12709
  const startTime = startDate;
12295
12710
  const endTime = eventTime.end.toDate();
12296
- const practitionerRef = doc25(this.db, PRACTITIONERS_COLLECTION, doctorId);
12297
- const practitionerDoc = await getDoc27(practitionerRef);
12711
+ const practitionerRef = doc26(this.db, PRACTITIONERS_COLLECTION, doctorId);
12712
+ const practitionerDoc = await getDoc28(practitionerRef);
12298
12713
  if (!practitionerDoc.exists()) {
12299
12714
  throw new Error(`Doctor with ID ${doctorId} not found`);
12300
12715
  }
@@ -12352,8 +12767,8 @@ var CalendarServiceV2 = class extends BaseService {
12352
12767
  */
12353
12768
  async updateAppointmentStatus(appointmentId, clinicId, status) {
12354
12769
  const baseCollectionPath = `${CLINICS_COLLECTION}/${clinicId}/${CALENDAR_COLLECTION}`;
12355
- const appointmentRef = doc25(this.db, baseCollectionPath, appointmentId);
12356
- const appointmentDoc = await getDoc27(appointmentRef);
12770
+ const appointmentRef = doc26(this.db, baseCollectionPath, appointmentId);
12771
+ const appointmentDoc = await getDoc28(appointmentRef);
12357
12772
  if (!appointmentDoc.exists()) {
12358
12773
  throw new Error(`Appointment with ID ${appointmentId} not found`);
12359
12774
  }
@@ -12488,7 +12903,7 @@ var CalendarServiceV2 = class extends BaseService {
12488
12903
  const newSyncEvent = {
12489
12904
  eventId: result.eventIds[0],
12490
12905
  syncedCalendarProvider: calendar.provider,
12491
- syncedAt: Timestamp27.now()
12906
+ syncedAt: Timestamp28.now()
12492
12907
  };
12493
12908
  await this.updateEventWithSyncId(
12494
12909
  entityType === "doctor" ? appointment.practitionerProfileId : appointment.patientProfileId,
@@ -12512,8 +12927,8 @@ var CalendarServiceV2 = class extends BaseService {
12512
12927
  async updateEventWithSyncId(entityId, entityType, eventId, syncEvent) {
12513
12928
  try {
12514
12929
  const collectionPath = entityType === "doctor" ? `${PRACTITIONERS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}` : `${PATIENTS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
12515
- const eventRef = doc25(this.db, collectionPath, eventId);
12516
- const eventDoc = await getDoc27(eventRef);
12930
+ const eventRef = doc26(this.db, collectionPath, eventId);
12931
+ const eventDoc = await getDoc28(eventRef);
12517
12932
  if (eventDoc.exists()) {
12518
12933
  const event = eventDoc.data();
12519
12934
  const syncIds = [...event.syncedCalendarEventId || []];
@@ -12525,9 +12940,9 @@ var CalendarServiceV2 = class extends BaseService {
12525
12940
  } else {
12526
12941
  syncIds.push(syncEvent);
12527
12942
  }
12528
- await updateDoc24(eventRef, {
12943
+ await updateDoc25(eventRef, {
12529
12944
  syncedCalendarEventId: syncIds,
12530
- updatedAt: serverTimestamp21()
12945
+ updatedAt: serverTimestamp22()
12531
12946
  });
12532
12947
  console.log(
12533
12948
  `Updated event ${eventId} with sync ID ${syncEvent.eventId}`
@@ -12551,8 +12966,8 @@ var CalendarServiceV2 = class extends BaseService {
12551
12966
  * @returns Working hours for the clinic
12552
12967
  */
12553
12968
  async getClinicWorkingHours(clinicId, date) {
12554
- const clinicRef = doc25(this.db, CLINICS_COLLECTION, clinicId);
12555
- const clinicDoc = await getDoc27(clinicRef);
12969
+ const clinicRef = doc26(this.db, CLINICS_COLLECTION, clinicId);
12970
+ const clinicDoc = await getDoc28(clinicRef);
12556
12971
  if (!clinicDoc.exists()) {
12557
12972
  throw new Error(`Clinic with ID ${clinicId} not found`);
12558
12973
  }
@@ -12580,8 +12995,8 @@ var CalendarServiceV2 = class extends BaseService {
12580
12995
  * @returns Doctor's schedule
12581
12996
  */
12582
12997
  async getDoctorSchedule(doctorId, date) {
12583
- const practitionerRef = doc25(this.db, PRACTITIONERS_COLLECTION, doctorId);
12584
- const practitionerDoc = await getDoc27(practitionerRef);
12998
+ const practitionerRef = doc26(this.db, PRACTITIONERS_COLLECTION, doctorId);
12999
+ const practitionerDoc = await getDoc28(practitionerRef);
12585
13000
  if (!practitionerDoc.exists()) {
12586
13001
  throw new Error(`Doctor with ID ${doctorId} not found`);
12587
13002
  }
@@ -12613,19 +13028,19 @@ var CalendarServiceV2 = class extends BaseService {
12613
13028
  startOfDay.setHours(0, 0, 0, 0);
12614
13029
  const endOfDay = new Date(date);
12615
13030
  endOfDay.setHours(23, 59, 59, 999);
12616
- const appointmentsRef = collection24(this.db, CALENDAR_COLLECTION);
12617
- const q = query24(
13031
+ const appointmentsRef = collection25(this.db, CALENDAR_COLLECTION);
13032
+ const q = query25(
12618
13033
  appointmentsRef,
12619
- where24("practitionerProfileId", "==", doctorId),
12620
- where24("eventTime.start", ">=", Timestamp27.fromDate(startOfDay)),
12621
- where24("eventTime.start", "<=", Timestamp27.fromDate(endOfDay)),
12622
- where24("status", "in", [
13034
+ where25("practitionerProfileId", "==", doctorId),
13035
+ where25("eventTime.start", ">=", Timestamp28.fromDate(startOfDay)),
13036
+ where25("eventTime.start", "<=", Timestamp28.fromDate(endOfDay)),
13037
+ where25("status", "in", [
12623
13038
  "confirmed" /* CONFIRMED */,
12624
13039
  "pending" /* PENDING */
12625
13040
  ])
12626
13041
  );
12627
- const querySnapshot = await getDocs24(q);
12628
- return querySnapshot.docs.map((doc34) => doc34.data());
13042
+ const querySnapshot = await getDocs25(q);
13043
+ return querySnapshot.docs.map((doc35) => doc35.data());
12629
13044
  }
12630
13045
  /**
12631
13046
  * Calculates available time slots based on working hours, schedule and existing appointments
@@ -12682,11 +13097,11 @@ var CalendarServiceV2 = class extends BaseService {
12682
13097
  var _a;
12683
13098
  try {
12684
13099
  const [clinicDoc, practitionerDoc, patientDoc, patientSensitiveInfoDoc] = await Promise.all([
12685
- getDoc27(doc25(this.db, CLINICS_COLLECTION, clinicId)),
12686
- getDoc27(doc25(this.db, PRACTITIONERS_COLLECTION, doctorId)),
12687
- getDoc27(doc25(this.db, PATIENTS_COLLECTION, patientId)),
12688
- getDoc27(
12689
- doc25(
13100
+ getDoc28(doc26(this.db, CLINICS_COLLECTION, clinicId)),
13101
+ getDoc28(doc26(this.db, PRACTITIONERS_COLLECTION, doctorId)),
13102
+ getDoc28(doc26(this.db, PATIENTS_COLLECTION, patientId)),
13103
+ getDoc28(
13104
+ doc26(
12690
13105
  this.db,
12691
13106
  PATIENTS_COLLECTION,
12692
13107
  patientId,
@@ -12719,7 +13134,7 @@ var CalendarServiceV2 = class extends BaseService {
12719
13134
  fullName: `${sensitiveData.firstName} ${sensitiveData.lastName}`,
12720
13135
  email: sensitiveData.email || "",
12721
13136
  phone: sensitiveData.phoneNumber || null,
12722
- dateOfBirth: sensitiveData.dateOfBirth || Timestamp27.now(),
13137
+ dateOfBirth: sensitiveData.dateOfBirth || Timestamp28.now(),
12723
13138
  gender: sensitiveData.gender || "other" /* OTHER */
12724
13139
  };
12725
13140
  } else if (patientDoc.exists()) {
@@ -12728,7 +13143,7 @@ var CalendarServiceV2 = class extends BaseService {
12728
13143
  fullName: patientDoc.data().displayName,
12729
13144
  email: ((_a = patientDoc.data().contactInfo) == null ? void 0 : _a.email) || "",
12730
13145
  phone: patientDoc.data().phoneNumber || null,
12731
- dateOfBirth: patientDoc.data().dateOfBirth || Timestamp27.now(),
13146
+ dateOfBirth: patientDoc.data().dateOfBirth || Timestamp28.now(),
12732
13147
  gender: patientDoc.data().gender || "other" /* OTHER */
12733
13148
  };
12734
13149
  }
@@ -12751,15 +13166,15 @@ var CalendarServiceV2 = class extends BaseService {
12751
13166
 
12752
13167
  // src/services/reviews/reviews.service.ts
12753
13168
  import {
12754
- collection as collection25,
12755
- doc as doc26,
12756
- getDoc as getDoc28,
12757
- getDocs as getDocs25,
12758
- query as query25,
12759
- where as where25,
12760
- setDoc as setDoc23,
12761
- deleteDoc as deleteDoc16,
12762
- serverTimestamp as serverTimestamp22
13169
+ collection as collection26,
13170
+ doc as doc27,
13171
+ getDoc as getDoc29,
13172
+ getDocs as getDocs26,
13173
+ query as query26,
13174
+ where as where26,
13175
+ setDoc as setDoc24,
13176
+ deleteDoc as deleteDoc17,
13177
+ serverTimestamp as serverTimestamp23
12763
13178
  } from "firebase/firestore";
12764
13179
 
12765
13180
  // src/types/reviews/index.ts
@@ -12845,11 +13260,11 @@ var ReviewService = class extends BaseService {
12845
13260
  updatedAt: now
12846
13261
  };
12847
13262
  reviewSchema.parse(review);
12848
- const docRef = doc26(this.db, REVIEWS_COLLECTION, reviewId);
12849
- await setDoc23(docRef, {
13263
+ const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13264
+ await setDoc24(docRef, {
12850
13265
  ...review,
12851
- createdAt: serverTimestamp22(),
12852
- updatedAt: serverTimestamp22()
13266
+ createdAt: serverTimestamp23(),
13267
+ updatedAt: serverTimestamp23()
12853
13268
  });
12854
13269
  return review;
12855
13270
  } catch (error) {
@@ -12865,8 +13280,8 @@ var ReviewService = class extends BaseService {
12865
13280
  * @returns The review if found, null otherwise
12866
13281
  */
12867
13282
  async getReview(reviewId) {
12868
- const docRef = doc26(this.db, REVIEWS_COLLECTION, reviewId);
12869
- const docSnap = await getDoc28(docRef);
13283
+ const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13284
+ const docSnap = await getDoc29(docRef);
12870
13285
  if (!docSnap.exists()) {
12871
13286
  return null;
12872
13287
  }
@@ -12878,12 +13293,12 @@ var ReviewService = class extends BaseService {
12878
13293
  * @returns Array of reviews for the patient
12879
13294
  */
12880
13295
  async getReviewsByPatient(patientId) {
12881
- const q = query25(
12882
- collection25(this.db, REVIEWS_COLLECTION),
12883
- where25("patientId", "==", patientId)
13296
+ const q = query26(
13297
+ collection26(this.db, REVIEWS_COLLECTION),
13298
+ where26("patientId", "==", patientId)
12884
13299
  );
12885
- const snapshot = await getDocs25(q);
12886
- return snapshot.docs.map((doc34) => doc34.data());
13300
+ const snapshot = await getDocs26(q);
13301
+ return snapshot.docs.map((doc35) => doc35.data());
12887
13302
  }
12888
13303
  /**
12889
13304
  * Gets all reviews for a specific clinic
@@ -12891,12 +13306,12 @@ var ReviewService = class extends BaseService {
12891
13306
  * @returns Array of reviews containing clinic reviews
12892
13307
  */
12893
13308
  async getReviewsByClinic(clinicId) {
12894
- const q = query25(
12895
- collection25(this.db, REVIEWS_COLLECTION),
12896
- where25("clinicReview.clinicId", "==", clinicId)
13309
+ const q = query26(
13310
+ collection26(this.db, REVIEWS_COLLECTION),
13311
+ where26("clinicReview.clinicId", "==", clinicId)
12897
13312
  );
12898
- const snapshot = await getDocs25(q);
12899
- return snapshot.docs.map((doc34) => doc34.data());
13313
+ const snapshot = await getDocs26(q);
13314
+ return snapshot.docs.map((doc35) => doc35.data());
12900
13315
  }
12901
13316
  /**
12902
13317
  * Gets all reviews for a specific practitioner
@@ -12904,12 +13319,12 @@ var ReviewService = class extends BaseService {
12904
13319
  * @returns Array of reviews containing practitioner reviews
12905
13320
  */
12906
13321
  async getReviewsByPractitioner(practitionerId) {
12907
- const q = query25(
12908
- collection25(this.db, REVIEWS_COLLECTION),
12909
- where25("practitionerReview.practitionerId", "==", practitionerId)
13322
+ const q = query26(
13323
+ collection26(this.db, REVIEWS_COLLECTION),
13324
+ where26("practitionerReview.practitionerId", "==", practitionerId)
12910
13325
  );
12911
- const snapshot = await getDocs25(q);
12912
- return snapshot.docs.map((doc34) => doc34.data());
13326
+ const snapshot = await getDocs26(q);
13327
+ return snapshot.docs.map((doc35) => doc35.data());
12913
13328
  }
12914
13329
  /**
12915
13330
  * Gets all reviews for a specific procedure
@@ -12917,12 +13332,12 @@ var ReviewService = class extends BaseService {
12917
13332
  * @returns Array of reviews containing procedure reviews
12918
13333
  */
12919
13334
  async getReviewsByProcedure(procedureId) {
12920
- const q = query25(
12921
- collection25(this.db, REVIEWS_COLLECTION),
12922
- where25("procedureReview.procedureId", "==", procedureId)
13335
+ const q = query26(
13336
+ collection26(this.db, REVIEWS_COLLECTION),
13337
+ where26("procedureReview.procedureId", "==", procedureId)
12923
13338
  );
12924
- const snapshot = await getDocs25(q);
12925
- return snapshot.docs.map((doc34) => doc34.data());
13339
+ const snapshot = await getDocs26(q);
13340
+ return snapshot.docs.map((doc35) => doc35.data());
12926
13341
  }
12927
13342
  /**
12928
13343
  * Gets all reviews for a specific appointment
@@ -12930,11 +13345,11 @@ var ReviewService = class extends BaseService {
12930
13345
  * @returns The review for the appointment if found, null otherwise
12931
13346
  */
12932
13347
  async getReviewByAppointment(appointmentId) {
12933
- const q = query25(
12934
- collection25(this.db, REVIEWS_COLLECTION),
12935
- where25("appointmentId", "==", appointmentId)
13348
+ const q = query26(
13349
+ collection26(this.db, REVIEWS_COLLECTION),
13350
+ where26("appointmentId", "==", appointmentId)
12936
13351
  );
12937
- const snapshot = await getDocs25(q);
13352
+ const snapshot = await getDocs26(q);
12938
13353
  if (snapshot.empty) {
12939
13354
  return null;
12940
13355
  }
@@ -12949,7 +13364,7 @@ var ReviewService = class extends BaseService {
12949
13364
  if (!review) {
12950
13365
  throw new Error(`Review with ID ${reviewId} not found`);
12951
13366
  }
12952
- await deleteDoc16(doc26(this.db, REVIEWS_COLLECTION, reviewId));
13367
+ await deleteDoc17(doc27(this.db, REVIEWS_COLLECTION, reviewId));
12953
13368
  }
12954
13369
  /**
12955
13370
  * Calculates the average of an array of numbers
@@ -12968,34 +13383,34 @@ var ReviewService = class extends BaseService {
12968
13383
 
12969
13384
  // src/services/appointment/appointment.service.ts
12970
13385
  import {
12971
- Timestamp as Timestamp29,
12972
- serverTimestamp as serverTimestamp24,
13386
+ Timestamp as Timestamp30,
13387
+ serverTimestamp as serverTimestamp25,
12973
13388
  arrayUnion as arrayUnion8,
12974
13389
  arrayRemove as arrayRemove7,
12975
- where as where27,
12976
- orderBy as orderBy14,
12977
- collection as collection27,
12978
- query as query27,
12979
- limit as limit12,
13390
+ where as where28,
13391
+ orderBy as orderBy15,
13392
+ collection as collection28,
13393
+ query as query28,
13394
+ limit as limit13,
12980
13395
  startAfter as startAfter11,
12981
- getDocs as getDocs27
13396
+ getDocs as getDocs28
12982
13397
  } from "firebase/firestore";
12983
13398
  import { getFunctions as getFunctions2 } from "firebase/functions";
12984
13399
 
12985
13400
  // src/services/appointment/utils/appointment.utils.ts
12986
13401
  import {
12987
- collection as collection26,
12988
- doc as doc27,
12989
- getDoc as getDoc29,
12990
- getDocs as getDocs26,
12991
- query as query26,
12992
- where as where26,
12993
- setDoc as setDoc24,
12994
- updateDoc as updateDoc25,
12995
- serverTimestamp as serverTimestamp23,
12996
- Timestamp as Timestamp28,
12997
- orderBy as orderBy13,
12998
- limit as limit11,
13402
+ collection as collection27,
13403
+ doc as doc28,
13404
+ getDoc as getDoc30,
13405
+ getDocs as getDocs27,
13406
+ query as query27,
13407
+ where as where27,
13408
+ setDoc as setDoc25,
13409
+ updateDoc as updateDoc26,
13410
+ serverTimestamp as serverTimestamp24,
13411
+ Timestamp as Timestamp29,
13412
+ orderBy as orderBy14,
13413
+ limit as limit12,
12999
13414
  startAfter as startAfter10
13000
13415
  } from "firebase/firestore";
13001
13416
 
@@ -13005,8 +13420,8 @@ var TECHNOLOGIES_COLLECTION = "technologies";
13005
13420
  // src/services/appointment/utils/appointment.utils.ts
13006
13421
  async function updateAppointmentUtil2(db, appointmentId, data) {
13007
13422
  try {
13008
- const appointmentRef = doc27(db, APPOINTMENTS_COLLECTION, appointmentId);
13009
- const appointmentDoc = await getDoc29(appointmentRef);
13423
+ const appointmentRef = doc28(db, APPOINTMENTS_COLLECTION, appointmentId);
13424
+ const appointmentDoc = await getDoc30(appointmentRef);
13010
13425
  if (!appointmentDoc.exists()) {
13011
13426
  throw new Error(`Appointment with ID ${appointmentId} not found`);
13012
13427
  }
@@ -13055,7 +13470,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13055
13470
  ...data,
13056
13471
  completedPreRequirements,
13057
13472
  completedPostRequirements,
13058
- updatedAt: serverTimestamp23()
13473
+ updatedAt: serverTimestamp24()
13059
13474
  };
13060
13475
  Object.keys(updateData).forEach((key) => {
13061
13476
  if (updateData[key] === void 0) {
@@ -13064,7 +13479,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13064
13479
  });
13065
13480
  if (data.status && data.status !== currentAppointment.status) {
13066
13481
  if (data.status === "confirmed" /* CONFIRMED */ && !updateData.confirmationTime) {
13067
- updateData.confirmationTime = Timestamp28.now();
13482
+ updateData.confirmationTime = Timestamp29.now();
13068
13483
  }
13069
13484
  if (currentAppointment.calendarEventId) {
13070
13485
  await updateCalendarEventStatus(
@@ -13074,8 +13489,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13074
13489
  );
13075
13490
  }
13076
13491
  }
13077
- await updateDoc25(appointmentRef, updateData);
13078
- const updatedAppointmentDoc = await getDoc29(appointmentRef);
13492
+ await updateDoc26(appointmentRef, updateData);
13493
+ const updatedAppointmentDoc = await getDoc30(appointmentRef);
13079
13494
  if (!updatedAppointmentDoc.exists()) {
13080
13495
  throw new Error(
13081
13496
  `Failed to retrieve updated appointment ${appointmentId}`
@@ -13089,8 +13504,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13089
13504
  }
13090
13505
  async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus) {
13091
13506
  try {
13092
- const calendarEventRef = doc27(db, CALENDAR_COLLECTION, calendarEventId);
13093
- const calendarEventDoc = await getDoc29(calendarEventRef);
13507
+ const calendarEventRef = doc28(db, CALENDAR_COLLECTION, calendarEventId);
13508
+ const calendarEventDoc = await getDoc30(calendarEventRef);
13094
13509
  if (!calendarEventDoc.exists()) {
13095
13510
  console.warn(`Calendar event with ID ${calendarEventId} not found`);
13096
13511
  return;
@@ -13113,9 +13528,9 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13113
13528
  default:
13114
13529
  return;
13115
13530
  }
13116
- await updateDoc25(calendarEventRef, {
13531
+ await updateDoc26(calendarEventRef, {
13117
13532
  status: calendarStatus,
13118
- updatedAt: serverTimestamp23()
13533
+ updatedAt: serverTimestamp24()
13119
13534
  });
13120
13535
  } catch (error) {
13121
13536
  console.error(`Error updating calendar event ${calendarEventId}:`, error);
@@ -13123,8 +13538,8 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13123
13538
  }
13124
13539
  async function getAppointmentByIdUtil(db, appointmentId) {
13125
13540
  try {
13126
- const appointmentDoc = await getDoc29(
13127
- doc27(db, APPOINTMENTS_COLLECTION, appointmentId)
13541
+ const appointmentDoc = await getDoc30(
13542
+ doc28(db, APPOINTMENTS_COLLECTION, appointmentId)
13128
13543
  );
13129
13544
  if (!appointmentDoc.exists()) {
13130
13545
  return null;
@@ -13139,46 +13554,46 @@ async function searchAppointmentsUtil(db, params) {
13139
13554
  try {
13140
13555
  const constraints = [];
13141
13556
  if (params.patientId) {
13142
- constraints.push(where26("patientId", "==", params.patientId));
13557
+ constraints.push(where27("patientId", "==", params.patientId));
13143
13558
  }
13144
13559
  if (params.practitionerId) {
13145
- constraints.push(where26("practitionerId", "==", params.practitionerId));
13560
+ constraints.push(where27("practitionerId", "==", params.practitionerId));
13146
13561
  }
13147
13562
  if (params.clinicBranchId) {
13148
- constraints.push(where26("clinicBranchId", "==", params.clinicBranchId));
13563
+ constraints.push(where27("clinicBranchId", "==", params.clinicBranchId));
13149
13564
  }
13150
13565
  if (params.startDate) {
13151
13566
  constraints.push(
13152
- where26(
13567
+ where27(
13153
13568
  "appointmentStartTime",
13154
13569
  ">=",
13155
- Timestamp28.fromDate(params.startDate)
13570
+ Timestamp29.fromDate(params.startDate)
13156
13571
  )
13157
13572
  );
13158
13573
  }
13159
13574
  if (params.endDate) {
13160
13575
  constraints.push(
13161
- where26("appointmentStartTime", "<=", Timestamp28.fromDate(params.endDate))
13576
+ where27("appointmentStartTime", "<=", Timestamp29.fromDate(params.endDate))
13162
13577
  );
13163
13578
  }
13164
13579
  if (params.status) {
13165
13580
  if (Array.isArray(params.status)) {
13166
- constraints.push(where26("status", "in", params.status));
13581
+ constraints.push(where27("status", "in", params.status));
13167
13582
  } else {
13168
- constraints.push(where26("status", "==", params.status));
13583
+ constraints.push(where27("status", "==", params.status));
13169
13584
  }
13170
13585
  }
13171
- constraints.push(orderBy13("appointmentStartTime", "asc"));
13586
+ constraints.push(orderBy14("appointmentStartTime", "asc"));
13172
13587
  if (params.limit) {
13173
- constraints.push(limit11(params.limit));
13588
+ constraints.push(limit12(params.limit));
13174
13589
  }
13175
13590
  if (params.startAfter) {
13176
13591
  constraints.push(startAfter10(params.startAfter));
13177
13592
  }
13178
- const q = query26(collection26(db, APPOINTMENTS_COLLECTION), ...constraints);
13179
- const querySnapshot = await getDocs26(q);
13593
+ const q = query27(collection27(db, APPOINTMENTS_COLLECTION), ...constraints);
13594
+ const querySnapshot = await getDocs27(q);
13180
13595
  const appointments = querySnapshot.docs.map(
13181
- (doc34) => doc34.data()
13596
+ (doc35) => doc35.data()
13182
13597
  );
13183
13598
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
13184
13599
  return { appointments, lastDoc };
@@ -13547,7 +13962,7 @@ var AppointmentService = class extends BaseService {
13547
13962
  );
13548
13963
  const updateData = {
13549
13964
  status: newStatus,
13550
- updatedAt: serverTimestamp24()
13965
+ updatedAt: serverTimestamp25()
13551
13966
  };
13552
13967
  if (newStatus === "canceled_clinic" /* CANCELED_CLINIC */ || newStatus === "canceled_patient" /* CANCELED_PATIENT */ || newStatus === "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */) {
13553
13968
  if (!(details == null ? void 0 : details.cancellationReason)) {
@@ -13558,13 +13973,13 @@ var AppointmentService = class extends BaseService {
13558
13973
  }
13559
13974
  updateData.cancellationReason = details.cancellationReason;
13560
13975
  updateData.canceledBy = details.canceledBy;
13561
- updateData.cancellationTime = Timestamp29.now();
13976
+ updateData.cancellationTime = Timestamp30.now();
13562
13977
  }
13563
13978
  if (newStatus === "confirmed" /* CONFIRMED */) {
13564
- updateData.confirmationTime = Timestamp29.now();
13979
+ updateData.confirmationTime = Timestamp30.now();
13565
13980
  }
13566
13981
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
13567
- updateData.rescheduleTime = Timestamp29.now();
13982
+ updateData.rescheduleTime = Timestamp30.now();
13568
13983
  }
13569
13984
  return this.updateAppointment(appointmentId, updateData);
13570
13985
  }
@@ -13642,9 +14057,9 @@ var AppointmentService = class extends BaseService {
13642
14057
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
13643
14058
  appointmentStartTime: startTimestamp,
13644
14059
  appointmentEndTime: endTimestamp,
13645
- rescheduleTime: Timestamp29.now(),
14060
+ rescheduleTime: Timestamp30.now(),
13646
14061
  confirmationTime: null,
13647
- updatedAt: serverTimestamp24()
14062
+ updatedAt: serverTimestamp25()
13648
14063
  };
13649
14064
  return this.updateAppointment(validatedParams.appointmentId, updateData);
13650
14065
  }
@@ -13662,19 +14077,19 @@ var AppointmentService = class extends BaseService {
13662
14077
  return value;
13663
14078
  }
13664
14079
  if (typeof value === "number") {
13665
- return Timestamp29.fromMillis(value);
14080
+ return Timestamp30.fromMillis(value);
13666
14081
  }
13667
14082
  if (typeof value === "string") {
13668
- return Timestamp29.fromDate(new Date(value));
14083
+ return Timestamp30.fromDate(new Date(value));
13669
14084
  }
13670
14085
  if (value instanceof Date) {
13671
- return Timestamp29.fromDate(value);
14086
+ return Timestamp30.fromDate(value);
13672
14087
  }
13673
14088
  if (value && typeof value._seconds === "number") {
13674
- return new Timestamp29(value._seconds, value._nanoseconds || 0);
14089
+ return new Timestamp30(value._seconds, value._nanoseconds || 0);
13675
14090
  }
13676
14091
  if (value && typeof value.seconds === "number") {
13677
- return new Timestamp29(value.seconds, value.nanoseconds || 0);
14092
+ return new Timestamp30(value.seconds, value.nanoseconds || 0);
13678
14093
  }
13679
14094
  throw new Error(
13680
14095
  `Invalid timestamp format: ${typeof value}, value: ${JSON.stringify(
@@ -13773,9 +14188,9 @@ var AppointmentService = class extends BaseService {
13773
14188
  }
13774
14189
  const updateData = {
13775
14190
  status: "in_progress" /* IN_PROGRESS */,
13776
- procedureActualStartTime: Timestamp29.now(),
14191
+ procedureActualStartTime: Timestamp30.now(),
13777
14192
  // Set actual start time
13778
- updatedAt: serverTimestamp24()
14193
+ updatedAt: serverTimestamp25()
13779
14194
  };
13780
14195
  return this.updateAppointment(appointmentId, updateData);
13781
14196
  }
@@ -13793,7 +14208,7 @@ var AppointmentService = class extends BaseService {
13793
14208
  if (!appointment)
13794
14209
  throw new Error(`Appointment ${appointmentId} not found.`);
13795
14210
  let calculatedDurationMinutes = actualDurationMinutesInput;
13796
- const procedureCompletionTime = Timestamp29.now();
14211
+ const procedureCompletionTime = Timestamp30.now();
13797
14212
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
13798
14213
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
13799
14214
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -13816,7 +14231,7 @@ var AppointmentService = class extends BaseService {
13816
14231
  },
13817
14232
  // Optionally update appointmentEndTime to the actual completion time
13818
14233
  // appointmentEndTime: procedureCompletionTime,
13819
- updatedAt: serverTimestamp24()
14234
+ updatedAt: serverTimestamp25()
13820
14235
  };
13821
14236
  return this.updateAppointment(appointmentId, updateData);
13822
14237
  }
@@ -13830,7 +14245,7 @@ var AppointmentService = class extends BaseService {
13830
14245
  const appointment = await this.getAppointmentById(appointmentId);
13831
14246
  if (!appointment)
13832
14247
  throw new Error(`Appointment ${appointmentId} not found.`);
13833
- if (Timestamp29.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
14248
+ if (Timestamp30.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
13834
14249
  throw new Error("Cannot mark no-show before appointment start time.");
13835
14250
  }
13836
14251
  return this.updateAppointmentStatus(
@@ -13854,12 +14269,12 @@ var AppointmentService = class extends BaseService {
13854
14269
  const newMediaItem = {
13855
14270
  ...mediaItemData,
13856
14271
  id: this.generateId(),
13857
- uploadedAt: Timestamp29.now(),
14272
+ uploadedAt: Timestamp30.now(),
13858
14273
  uploadedBy: currentUser.uid
13859
14274
  };
13860
14275
  const updateData = {
13861
14276
  media: arrayUnion8(newMediaItem),
13862
- updatedAt: serverTimestamp24()
14277
+ updatedAt: serverTimestamp25()
13863
14278
  };
13864
14279
  return this.updateAppointment(appointmentId, updateData);
13865
14280
  }
@@ -13880,7 +14295,7 @@ var AppointmentService = class extends BaseService {
13880
14295
  }
13881
14296
  const updateData = {
13882
14297
  media: arrayRemove7(mediaToRemove),
13883
- updatedAt: serverTimestamp24()
14298
+ updatedAt: serverTimestamp25()
13884
14299
  };
13885
14300
  return this.updateAppointment(appointmentId, updateData);
13886
14301
  }
@@ -13894,11 +14309,11 @@ var AppointmentService = class extends BaseService {
13894
14309
  const newReviewInfo = {
13895
14310
  ...reviewData,
13896
14311
  reviewId: this.generateId(),
13897
- reviewedAt: Timestamp29.now()
14312
+ reviewedAt: Timestamp30.now()
13898
14313
  };
13899
14314
  const updateData = {
13900
14315
  reviewInfo: newReviewInfo,
13901
- updatedAt: serverTimestamp24()
14316
+ updatedAt: serverTimestamp25()
13902
14317
  };
13903
14318
  return this.updateAppointment(appointmentId, updateData);
13904
14319
  }
@@ -13912,7 +14327,7 @@ var AppointmentService = class extends BaseService {
13912
14327
  const updateData = {
13913
14328
  paymentStatus,
13914
14329
  paymentTransactionId: paymentTransactionId || null,
13915
- updatedAt: serverTimestamp24()
14330
+ updatedAt: serverTimestamp25()
13916
14331
  };
13917
14332
  return this.updateAppointment(appointmentId, updateData);
13918
14333
  }
@@ -13954,38 +14369,38 @@ var AppointmentService = class extends BaseService {
13954
14369
  "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */
13955
14370
  ];
13956
14371
  const constraints = [];
13957
- constraints.push(where27("patientId", "==", patientId));
13958
- constraints.push(where27("status", "in", upcomingStatuses));
14372
+ constraints.push(where28("patientId", "==", patientId));
14373
+ constraints.push(where28("status", "in", upcomingStatuses));
13959
14374
  constraints.push(
13960
- where27(
14375
+ where28(
13961
14376
  "appointmentStartTime",
13962
14377
  ">=",
13963
- Timestamp29.fromDate(effectiveStartDate)
14378
+ Timestamp30.fromDate(effectiveStartDate)
13964
14379
  )
13965
14380
  );
13966
14381
  if (options == null ? void 0 : options.endDate) {
13967
14382
  constraints.push(
13968
- where27(
14383
+ where28(
13969
14384
  "appointmentStartTime",
13970
14385
  "<=",
13971
- Timestamp29.fromDate(options.endDate)
14386
+ Timestamp30.fromDate(options.endDate)
13972
14387
  )
13973
14388
  );
13974
14389
  }
13975
- constraints.push(orderBy14("appointmentStartTime", "asc"));
14390
+ constraints.push(orderBy15("appointmentStartTime", "asc"));
13976
14391
  if (options == null ? void 0 : options.limit) {
13977
- constraints.push(limit12(options.limit));
14392
+ constraints.push(limit13(options.limit));
13978
14393
  }
13979
14394
  if (options == null ? void 0 : options.startAfter) {
13980
14395
  constraints.push(startAfter11(options.startAfter));
13981
14396
  }
13982
- const q = query27(
13983
- collection27(this.db, APPOINTMENTS_COLLECTION),
14397
+ const q = query28(
14398
+ collection28(this.db, APPOINTMENTS_COLLECTION),
13984
14399
  ...constraints
13985
14400
  );
13986
- const querySnapshot = await getDocs27(q);
14401
+ const querySnapshot = await getDocs28(q);
13987
14402
  const appointments = querySnapshot.docs.map(
13988
- (doc34) => doc34.data()
14403
+ (doc35) => doc35.data()
13989
14404
  );
13990
14405
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
13991
14406
  console.log(
@@ -14027,38 +14442,38 @@ var AppointmentService = class extends BaseService {
14027
14442
  pastStatuses.push("no_show" /* NO_SHOW */);
14028
14443
  }
14029
14444
  const constraints = [];
14030
- constraints.push(where27("patientId", "==", patientId));
14031
- constraints.push(where27("status", "in", pastStatuses));
14445
+ constraints.push(where28("patientId", "==", patientId));
14446
+ constraints.push(where28("status", "in", pastStatuses));
14032
14447
  if (options == null ? void 0 : options.startDate) {
14033
14448
  constraints.push(
14034
- where27(
14449
+ where28(
14035
14450
  "appointmentStartTime",
14036
14451
  ">=",
14037
- Timestamp29.fromDate(options.startDate)
14452
+ Timestamp30.fromDate(options.startDate)
14038
14453
  )
14039
14454
  );
14040
14455
  }
14041
14456
  constraints.push(
14042
- where27(
14457
+ where28(
14043
14458
  "appointmentStartTime",
14044
14459
  "<=",
14045
- Timestamp29.fromDate(effectiveEndDate)
14460
+ Timestamp30.fromDate(effectiveEndDate)
14046
14461
  )
14047
14462
  );
14048
- constraints.push(orderBy14("appointmentStartTime", "desc"));
14463
+ constraints.push(orderBy15("appointmentStartTime", "desc"));
14049
14464
  if (options == null ? void 0 : options.limit) {
14050
- constraints.push(limit12(options.limit));
14465
+ constraints.push(limit13(options.limit));
14051
14466
  }
14052
14467
  if (options == null ? void 0 : options.startAfter) {
14053
14468
  constraints.push(startAfter11(options.startAfter));
14054
14469
  }
14055
- const q = query27(
14056
- collection27(this.db, APPOINTMENTS_COLLECTION),
14470
+ const q = query28(
14471
+ collection28(this.db, APPOINTMENTS_COLLECTION),
14057
14472
  ...constraints
14058
14473
  );
14059
- const querySnapshot = await getDocs27(q);
14474
+ const querySnapshot = await getDocs28(q);
14060
14475
  const appointments = querySnapshot.docs.map(
14061
- (doc34) => doc34.data()
14476
+ (doc35) => doc35.data()
14062
14477
  );
14063
14478
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
14064
14479
  console.log(
@@ -14077,17 +14492,17 @@ var AppointmentService = class extends BaseService {
14077
14492
 
14078
14493
  // src/services/patient/patientRequirements.service.ts
14079
14494
  import {
14080
- collection as collection28,
14081
- getDocs as getDocs28,
14082
- query as query28,
14083
- where as where28,
14084
- doc as doc28,
14085
- updateDoc as updateDoc26,
14086
- Timestamp as Timestamp30,
14087
- orderBy as orderBy15,
14088
- limit as limit13,
14495
+ collection as collection29,
14496
+ getDocs as getDocs29,
14497
+ query as query29,
14498
+ where as where29,
14499
+ doc as doc29,
14500
+ updateDoc as updateDoc27,
14501
+ Timestamp as Timestamp31,
14502
+ orderBy as orderBy16,
14503
+ limit as limit14,
14089
14504
  startAfter as startAfter12,
14090
- getDoc as getDoc30
14505
+ getDoc as getDoc31
14091
14506
  } from "firebase/firestore";
14092
14507
 
14093
14508
  // src/types/patient/patient-requirements.ts
@@ -14118,13 +14533,13 @@ var PatientRequirementsService = class extends BaseService {
14118
14533
  super(db, auth, app);
14119
14534
  }
14120
14535
  getPatientRequirementsCollectionRef(patientId) {
14121
- return collection28(
14536
+ return collection29(
14122
14537
  this.db,
14123
14538
  `patients/${patientId}/${PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME}`
14124
14539
  );
14125
14540
  }
14126
14541
  getPatientRequirementDocRef(patientId, instanceId) {
14127
- return doc28(
14542
+ return doc29(
14128
14543
  this.getPatientRequirementsCollectionRef(patientId),
14129
14544
  instanceId
14130
14545
  );
@@ -14137,7 +14552,7 @@ var PatientRequirementsService = class extends BaseService {
14137
14552
  */
14138
14553
  async getPatientRequirementInstance(patientId, instanceId) {
14139
14554
  const docRef = this.getPatientRequirementDocRef(patientId, instanceId);
14140
- const docSnap = await getDoc30(docRef);
14555
+ const docSnap = await getDoc31(docRef);
14141
14556
  if (!docSnap.exists()) {
14142
14557
  return null;
14143
14558
  }
@@ -14156,22 +14571,22 @@ var PatientRequirementsService = class extends BaseService {
14156
14571
  */
14157
14572
  async getAllPatientRequirementInstances(patientId, filters, pageLimit = 20, lastVisible) {
14158
14573
  const collRef = this.getPatientRequirementsCollectionRef(patientId);
14159
- let q = query28(collRef, orderBy15("createdAt", "desc"));
14574
+ let q = query29(collRef, orderBy16("createdAt", "desc"));
14160
14575
  const queryConstraints = [];
14161
14576
  if ((filters == null ? void 0 : filters.appointmentId) && filters.appointmentId !== "all") {
14162
14577
  queryConstraints.push(
14163
- where28("appointmentId", "==", filters.appointmentId)
14578
+ where29("appointmentId", "==", filters.appointmentId)
14164
14579
  );
14165
14580
  }
14166
14581
  if ((filters == null ? void 0 : filters.statuses) && filters.statuses.length > 0) {
14167
- queryConstraints.push(where28("overallStatus", "in", filters.statuses));
14582
+ queryConstraints.push(where29("overallStatus", "in", filters.statuses));
14168
14583
  }
14169
14584
  if (lastVisible) {
14170
14585
  queryConstraints.push(startAfter12(lastVisible));
14171
14586
  }
14172
- queryConstraints.push(limit13(pageLimit));
14173
- q = query28(collRef, ...queryConstraints);
14174
- const snapshot = await getDocs28(q);
14587
+ queryConstraints.push(limit14(pageLimit));
14588
+ q = query29(collRef, ...queryConstraints);
14589
+ const snapshot = await getDocs29(q);
14175
14590
  let requirements = snapshot.docs.map((docSnap) => {
14176
14591
  const data = docSnap.data();
14177
14592
  return { id: docSnap.id, ...data };
@@ -14214,7 +14629,7 @@ var PatientRequirementsService = class extends BaseService {
14214
14629
  */
14215
14630
  async completeInstruction(patientId, instanceId, instructionId) {
14216
14631
  const instanceRef = this.getPatientRequirementDocRef(patientId, instanceId);
14217
- const instanceSnap = await getDoc30(instanceRef);
14632
+ const instanceSnap = await getDoc31(instanceRef);
14218
14633
  if (!instanceSnap.exists()) {
14219
14634
  throw new Error(
14220
14635
  `PatientRequirementInstance ${instanceId} not found for patient ${patientId}.`
@@ -14242,7 +14657,7 @@ var PatientRequirementsService = class extends BaseService {
14242
14657
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
14243
14658
  );
14244
14659
  }
14245
- const now = Timestamp30.now();
14660
+ const now = Timestamp31.now();
14246
14661
  const updatedInstructions = [...instance.instructions];
14247
14662
  updatedInstructions[instructionIndex] = {
14248
14663
  ...instructionToUpdate,
@@ -14269,7 +14684,7 @@ var PatientRequirementsService = class extends BaseService {
14269
14684
  if (newOverallStatus !== instance.overallStatus) {
14270
14685
  updatePayload.overallStatus = newOverallStatus;
14271
14686
  }
14272
- await updateDoc26(instanceRef, updatePayload);
14687
+ await updateDoc27(instanceRef, updatePayload);
14273
14688
  return {
14274
14689
  ...instance,
14275
14690
  instructions: updatedInstructions,
@@ -14284,13 +14699,13 @@ var PatientRequirementsService = class extends BaseService {
14284
14699
  // src/backoffice/services/brand.service.ts
14285
14700
  import {
14286
14701
  addDoc as addDoc3,
14287
- collection as collection29,
14288
- doc as doc29,
14289
- getDoc as getDoc31,
14290
- getDocs as getDocs29,
14291
- query as query29,
14292
- updateDoc as updateDoc27,
14293
- where as where29
14702
+ collection as collection30,
14703
+ doc as doc30,
14704
+ getDoc as getDoc32,
14705
+ getDocs as getDocs30,
14706
+ query as query30,
14707
+ updateDoc as updateDoc28,
14708
+ where as where30
14294
14709
  } from "firebase/firestore";
14295
14710
 
14296
14711
  // src/backoffice/types/brand.types.ts
@@ -14302,7 +14717,7 @@ var BrandService = class extends BaseService {
14302
14717
  * Gets reference to brands collection
14303
14718
  */
14304
14719
  getBrandsRef() {
14305
- return collection29(this.db, BRANDS_COLLECTION);
14720
+ return collection30(this.db, BRANDS_COLLECTION);
14306
14721
  }
14307
14722
  /**
14308
14723
  * Creates a new brand
@@ -14322,12 +14737,12 @@ var BrandService = class extends BaseService {
14322
14737
  * Gets all active brands
14323
14738
  */
14324
14739
  async getAll() {
14325
- const q = query29(this.getBrandsRef(), where29("isActive", "==", true));
14326
- const snapshot = await getDocs29(q);
14740
+ const q = query30(this.getBrandsRef(), where30("isActive", "==", true));
14741
+ const snapshot = await getDocs30(q);
14327
14742
  return snapshot.docs.map(
14328
- (doc34) => ({
14329
- id: doc34.id,
14330
- ...doc34.data()
14743
+ (doc35) => ({
14744
+ id: doc35.id,
14745
+ ...doc35.data()
14331
14746
  })
14332
14747
  );
14333
14748
  }
@@ -14339,8 +14754,8 @@ var BrandService = class extends BaseService {
14339
14754
  ...brand,
14340
14755
  updatedAt: /* @__PURE__ */ new Date()
14341
14756
  };
14342
- const docRef = doc29(this.getBrandsRef(), brandId);
14343
- await updateDoc27(docRef, updateData);
14757
+ const docRef = doc30(this.getBrandsRef(), brandId);
14758
+ await updateDoc28(docRef, updateData);
14344
14759
  return this.getById(brandId);
14345
14760
  }
14346
14761
  /**
@@ -14355,8 +14770,8 @@ var BrandService = class extends BaseService {
14355
14770
  * Gets a brand by ID
14356
14771
  */
14357
14772
  async getById(brandId) {
14358
- const docRef = doc29(this.getBrandsRef(), brandId);
14359
- const docSnap = await getDoc31(docRef);
14773
+ const docRef = doc30(this.getBrandsRef(), brandId);
14774
+ const docSnap = await getDoc32(docRef);
14360
14775
  if (!docSnap.exists()) return null;
14361
14776
  return {
14362
14777
  id: docSnap.id,
@@ -14368,13 +14783,13 @@ var BrandService = class extends BaseService {
14368
14783
  // src/backoffice/services/category.service.ts
14369
14784
  import {
14370
14785
  addDoc as addDoc4,
14371
- collection as collection30,
14372
- doc as doc30,
14373
- getDoc as getDoc32,
14374
- getDocs as getDocs30,
14375
- query as query30,
14376
- updateDoc as updateDoc28,
14377
- where as where30
14786
+ collection as collection31,
14787
+ doc as doc31,
14788
+ getDoc as getDoc33,
14789
+ getDocs as getDocs31,
14790
+ query as query31,
14791
+ updateDoc as updateDoc29,
14792
+ where as where31
14378
14793
  } from "firebase/firestore";
14379
14794
 
14380
14795
  // src/backoffice/types/category.types.ts
@@ -14386,7 +14801,7 @@ var CategoryService = class extends BaseService {
14386
14801
  * Referenca na Firestore kolekciju kategorija
14387
14802
  */
14388
14803
  get categoriesRef() {
14389
- return collection30(this.db, CATEGORIES_COLLECTION);
14804
+ return collection31(this.db, CATEGORIES_COLLECTION);
14390
14805
  }
14391
14806
  /**
14392
14807
  * Kreira novu kategoriju u sistemu
@@ -14409,12 +14824,12 @@ var CategoryService = class extends BaseService {
14409
14824
  * @returns Lista aktivnih kategorija
14410
14825
  */
14411
14826
  async getAll() {
14412
- const q = query30(this.categoriesRef, where30("isActive", "==", true));
14413
- const snapshot = await getDocs30(q);
14827
+ const q = query31(this.categoriesRef, where31("isActive", "==", true));
14828
+ const snapshot = await getDocs31(q);
14414
14829
  return snapshot.docs.map(
14415
- (doc34) => ({
14416
- id: doc34.id,
14417
- ...doc34.data()
14830
+ (doc35) => ({
14831
+ id: doc35.id,
14832
+ ...doc35.data()
14418
14833
  })
14419
14834
  );
14420
14835
  }
@@ -14424,16 +14839,16 @@ var CategoryService = class extends BaseService {
14424
14839
  * @returns Lista kategorija koje pripadaju traženoj familiji
14425
14840
  */
14426
14841
  async getAllByFamily(family) {
14427
- const q = query30(
14842
+ const q = query31(
14428
14843
  this.categoriesRef,
14429
- where30("family", "==", family),
14430
- where30("isActive", "==", true)
14844
+ where31("family", "==", family),
14845
+ where31("isActive", "==", true)
14431
14846
  );
14432
- const snapshot = await getDocs30(q);
14847
+ const snapshot = await getDocs31(q);
14433
14848
  return snapshot.docs.map(
14434
- (doc34) => ({
14435
- id: doc34.id,
14436
- ...doc34.data()
14849
+ (doc35) => ({
14850
+ id: doc35.id,
14851
+ ...doc35.data()
14437
14852
  })
14438
14853
  );
14439
14854
  }
@@ -14448,8 +14863,8 @@ var CategoryService = class extends BaseService {
14448
14863
  ...category,
14449
14864
  updatedAt: /* @__PURE__ */ new Date()
14450
14865
  };
14451
- const docRef = doc30(this.categoriesRef, id);
14452
- await updateDoc28(docRef, updateData);
14866
+ const docRef = doc31(this.categoriesRef, id);
14867
+ await updateDoc29(docRef, updateData);
14453
14868
  return this.getById(id);
14454
14869
  }
14455
14870
  /**
@@ -14465,8 +14880,8 @@ var CategoryService = class extends BaseService {
14465
14880
  * @returns Kategorija ili null ako ne postoji
14466
14881
  */
14467
14882
  async getById(id) {
14468
- const docRef = doc30(this.categoriesRef, id);
14469
- const docSnap = await getDoc32(docRef);
14883
+ const docRef = doc31(this.categoriesRef, id);
14884
+ const docSnap = await getDoc33(docRef);
14470
14885
  if (!docSnap.exists()) return null;
14471
14886
  return {
14472
14887
  id: docSnap.id,
@@ -14478,13 +14893,13 @@ var CategoryService = class extends BaseService {
14478
14893
  // src/backoffice/services/subcategory.service.ts
14479
14894
  import {
14480
14895
  addDoc as addDoc5,
14481
- collection as collection31,
14482
- doc as doc31,
14483
- getDoc as getDoc33,
14484
- getDocs as getDocs31,
14485
- query as query31,
14486
- updateDoc as updateDoc29,
14487
- where as where31
14896
+ collection as collection32,
14897
+ doc as doc32,
14898
+ getDoc as getDoc34,
14899
+ getDocs as getDocs32,
14900
+ query as query32,
14901
+ updateDoc as updateDoc30,
14902
+ where as where32
14488
14903
  } from "firebase/firestore";
14489
14904
 
14490
14905
  // src/backoffice/types/subcategory.types.ts
@@ -14497,7 +14912,7 @@ var SubcategoryService = class extends BaseService {
14497
14912
  * @param categoryId - ID roditeljske kategorije
14498
14913
  */
14499
14914
  getSubcategoriesRef(categoryId) {
14500
- return collection31(
14915
+ return collection32(
14501
14916
  this.db,
14502
14917
  CATEGORIES_COLLECTION,
14503
14918
  categoryId,
@@ -14531,15 +14946,15 @@ var SubcategoryService = class extends BaseService {
14531
14946
  * @returns Lista aktivnih podkategorija
14532
14947
  */
14533
14948
  async getAllByCategoryId(categoryId) {
14534
- const q = query31(
14949
+ const q = query32(
14535
14950
  this.getSubcategoriesRef(categoryId),
14536
- where31("isActive", "==", true)
14951
+ where32("isActive", "==", true)
14537
14952
  );
14538
- const snapshot = await getDocs31(q);
14953
+ const snapshot = await getDocs32(q);
14539
14954
  return snapshot.docs.map(
14540
- (doc34) => ({
14541
- id: doc34.id,
14542
- ...doc34.data()
14955
+ (doc35) => ({
14956
+ id: doc35.id,
14957
+ ...doc35.data()
14543
14958
  })
14544
14959
  );
14545
14960
  }
@@ -14555,8 +14970,8 @@ var SubcategoryService = class extends BaseService {
14555
14970
  ...subcategory,
14556
14971
  updatedAt: /* @__PURE__ */ new Date()
14557
14972
  };
14558
- const docRef = doc31(this.getSubcategoriesRef(categoryId), subcategoryId);
14559
- await updateDoc29(docRef, updateData);
14973
+ const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14974
+ await updateDoc30(docRef, updateData);
14560
14975
  return this.getById(categoryId, subcategoryId);
14561
14976
  }
14562
14977
  /**
@@ -14574,8 +14989,8 @@ var SubcategoryService = class extends BaseService {
14574
14989
  * @returns Podkategorija ili null ako ne postoji
14575
14990
  */
14576
14991
  async getById(categoryId, subcategoryId) {
14577
- const docRef = doc31(this.getSubcategoriesRef(categoryId), subcategoryId);
14578
- const docSnap = await getDoc33(docRef);
14992
+ const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14993
+ const docSnap = await getDoc34(docRef);
14579
14994
  if (!docSnap.exists()) return null;
14580
14995
  return {
14581
14996
  id: docSnap.id,
@@ -14587,13 +15002,13 @@ var SubcategoryService = class extends BaseService {
14587
15002
  // src/backoffice/services/technology.service.ts
14588
15003
  import {
14589
15004
  addDoc as addDoc6,
14590
- collection as collection32,
14591
- doc as doc32,
14592
- getDoc as getDoc34,
14593
- getDocs as getDocs32,
14594
- query as query32,
14595
- updateDoc as updateDoc30,
14596
- where as where32,
15005
+ collection as collection33,
15006
+ doc as doc33,
15007
+ getDoc as getDoc35,
15008
+ getDocs as getDocs33,
15009
+ query as query33,
15010
+ updateDoc as updateDoc31,
15011
+ where as where33,
14597
15012
  arrayUnion as arrayUnion9,
14598
15013
  arrayRemove as arrayRemove8
14599
15014
  } from "firebase/firestore";
@@ -14606,7 +15021,7 @@ var TechnologyService = class extends BaseService {
14606
15021
  * Vraća referencu na Firestore kolekciju tehnologija
14607
15022
  */
14608
15023
  getTechnologiesRef() {
14609
- return collection32(this.db, TECHNOLOGIES_COLLECTION);
15024
+ return collection33(this.db, TECHNOLOGIES_COLLECTION);
14610
15025
  }
14611
15026
  /**
14612
15027
  * Kreira novu tehnologiju
@@ -14637,12 +15052,12 @@ var TechnologyService = class extends BaseService {
14637
15052
  * @returns Lista aktivnih tehnologija
14638
15053
  */
14639
15054
  async getAll() {
14640
- const q = query32(this.getTechnologiesRef(), where32("isActive", "==", true));
14641
- const snapshot = await getDocs32(q);
15055
+ const q = query33(this.getTechnologiesRef(), where33("isActive", "==", true));
15056
+ const snapshot = await getDocs33(q);
14642
15057
  return snapshot.docs.map(
14643
- (doc34) => ({
14644
- id: doc34.id,
14645
- ...doc34.data()
15058
+ (doc35) => ({
15059
+ id: doc35.id,
15060
+ ...doc35.data()
14646
15061
  })
14647
15062
  );
14648
15063
  }
@@ -14652,16 +15067,16 @@ var TechnologyService = class extends BaseService {
14652
15067
  * @returns Lista aktivnih tehnologija
14653
15068
  */
14654
15069
  async getAllByFamily(family) {
14655
- const q = query32(
15070
+ const q = query33(
14656
15071
  this.getTechnologiesRef(),
14657
- where32("isActive", "==", true),
14658
- where32("family", "==", family)
15072
+ where33("isActive", "==", true),
15073
+ where33("family", "==", family)
14659
15074
  );
14660
- const snapshot = await getDocs32(q);
15075
+ const snapshot = await getDocs33(q);
14661
15076
  return snapshot.docs.map(
14662
- (doc34) => ({
14663
- id: doc34.id,
14664
- ...doc34.data()
15077
+ (doc35) => ({
15078
+ id: doc35.id,
15079
+ ...doc35.data()
14665
15080
  })
14666
15081
  );
14667
15082
  }
@@ -14671,16 +15086,16 @@ var TechnologyService = class extends BaseService {
14671
15086
  * @returns Lista aktivnih tehnologija
14672
15087
  */
14673
15088
  async getAllByCategoryId(categoryId) {
14674
- const q = query32(
15089
+ const q = query33(
14675
15090
  this.getTechnologiesRef(),
14676
- where32("isActive", "==", true),
14677
- where32("categoryId", "==", categoryId)
15091
+ where33("isActive", "==", true),
15092
+ where33("categoryId", "==", categoryId)
14678
15093
  );
14679
- const snapshot = await getDocs32(q);
15094
+ const snapshot = await getDocs33(q);
14680
15095
  return snapshot.docs.map(
14681
- (doc34) => ({
14682
- id: doc34.id,
14683
- ...doc34.data()
15096
+ (doc35) => ({
15097
+ id: doc35.id,
15098
+ ...doc35.data()
14684
15099
  })
14685
15100
  );
14686
15101
  }
@@ -14690,16 +15105,16 @@ var TechnologyService = class extends BaseService {
14690
15105
  * @returns Lista aktivnih tehnologija
14691
15106
  */
14692
15107
  async getAllBySubcategoryId(subcategoryId) {
14693
- const q = query32(
15108
+ const q = query33(
14694
15109
  this.getTechnologiesRef(),
14695
- where32("isActive", "==", true),
14696
- where32("subcategoryId", "==", subcategoryId)
15110
+ where33("isActive", "==", true),
15111
+ where33("subcategoryId", "==", subcategoryId)
14697
15112
  );
14698
- const snapshot = await getDocs32(q);
15113
+ const snapshot = await getDocs33(q);
14699
15114
  return snapshot.docs.map(
14700
- (doc34) => ({
14701
- id: doc34.id,
14702
- ...doc34.data()
15115
+ (doc35) => ({
15116
+ id: doc35.id,
15117
+ ...doc35.data()
14703
15118
  })
14704
15119
  );
14705
15120
  }
@@ -14714,8 +15129,8 @@ var TechnologyService = class extends BaseService {
14714
15129
  ...technology,
14715
15130
  updatedAt: /* @__PURE__ */ new Date()
14716
15131
  };
14717
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14718
- await updateDoc30(docRef, updateData);
15132
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15133
+ await updateDoc31(docRef, updateData);
14719
15134
  return this.getById(technologyId);
14720
15135
  }
14721
15136
  /**
@@ -14733,8 +15148,8 @@ var TechnologyService = class extends BaseService {
14733
15148
  * @returns Tehnologija ili null ako ne postoji
14734
15149
  */
14735
15150
  async getById(technologyId) {
14736
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14737
- const docSnap = await getDoc34(docRef);
15151
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15152
+ const docSnap = await getDoc35(docRef);
14738
15153
  if (!docSnap.exists()) return null;
14739
15154
  return {
14740
15155
  id: docSnap.id,
@@ -14748,9 +15163,9 @@ var TechnologyService = class extends BaseService {
14748
15163
  * @returns Ažurirana tehnologija sa novim zahtevom
14749
15164
  */
14750
15165
  async addRequirement(technologyId, requirement) {
14751
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
15166
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
14752
15167
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
14753
- await updateDoc30(docRef, {
15168
+ await updateDoc31(docRef, {
14754
15169
  [requirementType]: arrayUnion9(requirement),
14755
15170
  updatedAt: /* @__PURE__ */ new Date()
14756
15171
  });
@@ -14763,9 +15178,9 @@ var TechnologyService = class extends BaseService {
14763
15178
  * @returns Ažurirana tehnologija bez uklonjenog zahteva
14764
15179
  */
14765
15180
  async removeRequirement(technologyId, requirement) {
14766
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
15181
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
14767
15182
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
14768
- await updateDoc30(docRef, {
15183
+ await updateDoc31(docRef, {
14769
15184
  [requirementType]: arrayRemove8(requirement),
14770
15185
  updatedAt: /* @__PURE__ */ new Date()
14771
15186
  });
@@ -14803,8 +15218,8 @@ var TechnologyService = class extends BaseService {
14803
15218
  * @returns Ažurirana tehnologija
14804
15219
  */
14805
15220
  async addBlockingCondition(technologyId, condition) {
14806
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14807
- await updateDoc30(docRef, {
15221
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15222
+ await updateDoc31(docRef, {
14808
15223
  blockingConditions: arrayUnion9(condition),
14809
15224
  updatedAt: /* @__PURE__ */ new Date()
14810
15225
  });
@@ -14817,8 +15232,8 @@ var TechnologyService = class extends BaseService {
14817
15232
  * @returns Ažurirana tehnologija
14818
15233
  */
14819
15234
  async removeBlockingCondition(technologyId, condition) {
14820
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14821
- await updateDoc30(docRef, {
15235
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15236
+ await updateDoc31(docRef, {
14822
15237
  blockingConditions: arrayRemove8(condition),
14823
15238
  updatedAt: /* @__PURE__ */ new Date()
14824
15239
  });
@@ -14831,8 +15246,8 @@ var TechnologyService = class extends BaseService {
14831
15246
  * @returns Ažurirana tehnologija
14832
15247
  */
14833
15248
  async addContraindication(technologyId, contraindication) {
14834
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14835
- await updateDoc30(docRef, {
15249
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15250
+ await updateDoc31(docRef, {
14836
15251
  contraindications: arrayUnion9(contraindication),
14837
15252
  updatedAt: /* @__PURE__ */ new Date()
14838
15253
  });
@@ -14845,8 +15260,8 @@ var TechnologyService = class extends BaseService {
14845
15260
  * @returns Ažurirana tehnologija
14846
15261
  */
14847
15262
  async removeContraindication(technologyId, contraindication) {
14848
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14849
- await updateDoc30(docRef, {
15263
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15264
+ await updateDoc31(docRef, {
14850
15265
  contraindications: arrayRemove8(contraindication),
14851
15266
  updatedAt: /* @__PURE__ */ new Date()
14852
15267
  });
@@ -14859,8 +15274,8 @@ var TechnologyService = class extends BaseService {
14859
15274
  * @returns Ažurirana tehnologija
14860
15275
  */
14861
15276
  async addBenefit(technologyId, benefit) {
14862
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14863
- await updateDoc30(docRef, {
15277
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15278
+ await updateDoc31(docRef, {
14864
15279
  benefits: arrayUnion9(benefit),
14865
15280
  updatedAt: /* @__PURE__ */ new Date()
14866
15281
  });
@@ -14873,8 +15288,8 @@ var TechnologyService = class extends BaseService {
14873
15288
  * @returns Ažurirana tehnologija
14874
15289
  */
14875
15290
  async removeBenefit(technologyId, benefit) {
14876
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14877
- await updateDoc30(docRef, {
15291
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15292
+ await updateDoc31(docRef, {
14878
15293
  benefits: arrayRemove8(benefit),
14879
15294
  updatedAt: /* @__PURE__ */ new Date()
14880
15295
  });
@@ -14914,8 +15329,8 @@ var TechnologyService = class extends BaseService {
14914
15329
  * @returns Ažurirana tehnologija
14915
15330
  */
14916
15331
  async updateCertificationRequirement(technologyId, certificationRequirement) {
14917
- const docRef = doc32(this.getTechnologiesRef(), technologyId);
14918
- await updateDoc30(docRef, {
15332
+ const docRef = doc33(this.getTechnologiesRef(), technologyId);
15333
+ await updateDoc31(docRef, {
14919
15334
  certificationRequirement,
14920
15335
  updatedAt: /* @__PURE__ */ new Date()
14921
15336
  });
@@ -15017,13 +15432,13 @@ var TechnologyService = class extends BaseService {
15017
15432
  // src/backoffice/services/product.service.ts
15018
15433
  import {
15019
15434
  addDoc as addDoc7,
15020
- collection as collection33,
15021
- doc as doc33,
15022
- getDoc as getDoc35,
15023
- getDocs as getDocs33,
15024
- query as query33,
15025
- updateDoc as updateDoc31,
15026
- where as where33
15435
+ collection as collection34,
15436
+ doc as doc34,
15437
+ getDoc as getDoc36,
15438
+ getDocs as getDocs34,
15439
+ query as query34,
15440
+ updateDoc as updateDoc32,
15441
+ where as where34
15027
15442
  } from "firebase/firestore";
15028
15443
 
15029
15444
  // src/backoffice/types/product.types.ts
@@ -15037,7 +15452,7 @@ var ProductService = class extends BaseService {
15037
15452
  * @returns Firestore collection reference
15038
15453
  */
15039
15454
  getProductsRef(technologyId) {
15040
- return collection33(
15455
+ return collection34(
15041
15456
  this.db,
15042
15457
  TECHNOLOGIES_COLLECTION,
15043
15458
  technologyId,
@@ -15067,15 +15482,15 @@ var ProductService = class extends BaseService {
15067
15482
  * Gets all products for a technology
15068
15483
  */
15069
15484
  async getAllByTechnology(technologyId) {
15070
- const q = query33(
15485
+ const q = query34(
15071
15486
  this.getProductsRef(technologyId),
15072
- where33("isActive", "==", true)
15487
+ where34("isActive", "==", true)
15073
15488
  );
15074
- const snapshot = await getDocs33(q);
15489
+ const snapshot = await getDocs34(q);
15075
15490
  return snapshot.docs.map(
15076
- (doc34) => ({
15077
- id: doc34.id,
15078
- ...doc34.data()
15491
+ (doc35) => ({
15492
+ id: doc35.id,
15493
+ ...doc35.data()
15079
15494
  })
15080
15495
  );
15081
15496
  }
@@ -15083,21 +15498,21 @@ var ProductService = class extends BaseService {
15083
15498
  * Gets all products for a brand by filtering through all technologies
15084
15499
  */
15085
15500
  async getAllByBrand(brandId) {
15086
- const allTechnologiesRef = collection33(this.db, TECHNOLOGIES_COLLECTION);
15087
- const technologiesSnapshot = await getDocs33(allTechnologiesRef);
15501
+ const allTechnologiesRef = collection34(this.db, TECHNOLOGIES_COLLECTION);
15502
+ const technologiesSnapshot = await getDocs34(allTechnologiesRef);
15088
15503
  const products = [];
15089
15504
  for (const techDoc of technologiesSnapshot.docs) {
15090
- const q = query33(
15505
+ const q = query34(
15091
15506
  this.getProductsRef(techDoc.id),
15092
- where33("brandId", "==", brandId),
15093
- where33("isActive", "==", true)
15507
+ where34("brandId", "==", brandId),
15508
+ where34("isActive", "==", true)
15094
15509
  );
15095
- const snapshot = await getDocs33(q);
15510
+ const snapshot = await getDocs34(q);
15096
15511
  products.push(
15097
15512
  ...snapshot.docs.map(
15098
- (doc34) => ({
15099
- id: doc34.id,
15100
- ...doc34.data()
15513
+ (doc35) => ({
15514
+ id: doc35.id,
15515
+ ...doc35.data()
15101
15516
  })
15102
15517
  )
15103
15518
  );
@@ -15112,8 +15527,8 @@ var ProductService = class extends BaseService {
15112
15527
  ...product,
15113
15528
  updatedAt: /* @__PURE__ */ new Date()
15114
15529
  };
15115
- const docRef = doc33(this.getProductsRef(technologyId), productId);
15116
- await updateDoc31(docRef, updateData);
15530
+ const docRef = doc34(this.getProductsRef(technologyId), productId);
15531
+ await updateDoc32(docRef, updateData);
15117
15532
  return this.getById(technologyId, productId);
15118
15533
  }
15119
15534
  /**
@@ -15128,8 +15543,8 @@ var ProductService = class extends BaseService {
15128
15543
  * Gets a product by ID
15129
15544
  */
15130
15545
  async getById(technologyId, productId) {
15131
- const docRef = doc33(this.getProductsRef(technologyId), productId);
15132
- const docSnap = await getDoc35(docRef);
15546
+ const docRef = doc34(this.getProductsRef(technologyId), productId);
15547
+ const docSnap = await getDoc36(docRef);
15133
15548
  if (!docSnap.exists()) return null;
15134
15549
  return {
15135
15550
  id: docSnap.id,
@@ -15293,6 +15708,7 @@ export {
15293
15708
  PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME,
15294
15709
  PATIENT_SENSITIVE_INFO_COLLECTION,
15295
15710
  PRACTITIONERS_COLLECTION,
15711
+ PRACTITIONER_INVITES_COLLECTION,
15296
15712
  PROCEDURES_COLLECTION,
15297
15713
  PatientInstructionStatus,
15298
15714
  PatientRequirementOverallStatus,
@@ -15300,6 +15716,8 @@ export {
15300
15716
  PatientService,
15301
15717
  PaymentStatus,
15302
15718
  PracticeType,
15719
+ PractitionerInviteService,
15720
+ PractitionerInviteStatus,
15303
15721
  PractitionerService,
15304
15722
  PractitionerStatus,
15305
15723
  PractitionerTokenStatus,