@blackcode_sa/metaestetics-api 1.5.17 → 1.5.19

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
@@ -134,6 +134,12 @@ var CalendarEventType = /* @__PURE__ */ ((CalendarEventType3) => {
134
134
  return CalendarEventType3;
135
135
  })(CalendarEventType || {});
136
136
  var CALENDAR_COLLECTION = "calendar";
137
+ var SearchLocationEnum = /* @__PURE__ */ ((SearchLocationEnum2) => {
138
+ SearchLocationEnum2["PRACTITIONER"] = "practitioner";
139
+ SearchLocationEnum2["PATIENT"] = "patient";
140
+ SearchLocationEnum2["CLINIC"] = "clinic";
141
+ return SearchLocationEnum2;
142
+ })(SearchLocationEnum || {});
137
143
 
138
144
  // src/types/index.ts
139
145
  var UserRole = /* @__PURE__ */ ((UserRole2) => {
@@ -578,7 +584,7 @@ var BaseService = class {
578
584
  // src/services/user.service.ts
579
585
  import {
580
586
  collection as collection5,
581
- doc as doc6,
587
+ doc as doc7,
582
588
  getDoc as getDoc10,
583
589
  getDocs as getDocs5,
584
590
  query as query5,
@@ -687,7 +693,7 @@ import { z as z12 } from "zod";
687
693
 
688
694
  // src/services/patient/patient.service.ts
689
695
  import {
690
- doc as doc3,
696
+ doc as doc4,
691
697
  getDoc as getDoc7,
692
698
  writeBatch
693
699
  } from "firebase/firestore";
@@ -705,14 +711,12 @@ import {
705
711
  collection as collection2,
706
712
  query as query2,
707
713
  where as where2,
708
- getDocs as getDocs2
714
+ getDocs as getDocs2,
715
+ limit,
716
+ startAfter,
717
+ doc as doc3
709
718
  } from "firebase/firestore";
710
- import {
711
- ref,
712
- uploadBytes,
713
- getDownloadURL,
714
- deleteObject
715
- } from "firebase/storage";
719
+ import { ref, uploadBytes, getDownloadURL, deleteObject } from "firebase/storage";
716
720
  import { z as z7 } from "zod";
717
721
 
718
722
  // src/types/patient/medical-info.types.ts
@@ -1345,9 +1349,9 @@ var addAllergyUtil = async (db, patientId, data, userRef) => {
1345
1349
  var updateAllergyUtil = async (db, patientId, data, userRef) => {
1346
1350
  const validatedData = updateAllergySchema.parse(data);
1347
1351
  const { allergyIndex, ...updateData } = validatedData;
1348
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1349
- if (!doc27.exists()) throw new Error("Medical info not found");
1350
- const medicalInfo = doc27.data();
1352
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1353
+ if (!doc28.exists()) throw new Error("Medical info not found");
1354
+ const medicalInfo = doc28.data();
1351
1355
  if (allergyIndex >= medicalInfo.allergies.length) {
1352
1356
  throw new Error("Invalid allergy index");
1353
1357
  }
@@ -1363,9 +1367,9 @@ var updateAllergyUtil = async (db, patientId, data, userRef) => {
1363
1367
  });
1364
1368
  };
1365
1369
  var removeAllergyUtil = async (db, patientId, allergyIndex, userRef) => {
1366
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1367
- if (!doc27.exists()) throw new Error("Medical info not found");
1368
- const medicalInfo = doc27.data();
1370
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1371
+ if (!doc28.exists()) throw new Error("Medical info not found");
1372
+ const medicalInfo = doc28.data();
1369
1373
  if (allergyIndex >= medicalInfo.allergies.length) {
1370
1374
  throw new Error("Invalid allergy index");
1371
1375
  }
@@ -1390,9 +1394,9 @@ var addBlockingConditionUtil = async (db, patientId, data, userRef) => {
1390
1394
  var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
1391
1395
  const validatedData = updateBlockingConditionSchema.parse(data);
1392
1396
  const { conditionIndex, ...updateData } = validatedData;
1393
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1394
- if (!doc27.exists()) throw new Error("Medical info not found");
1395
- const medicalInfo = doc27.data();
1397
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1398
+ if (!doc28.exists()) throw new Error("Medical info not found");
1399
+ const medicalInfo = doc28.data();
1396
1400
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
1397
1401
  throw new Error("Invalid blocking condition index");
1398
1402
  }
@@ -1408,9 +1412,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
1408
1412
  });
1409
1413
  };
1410
1414
  var removeBlockingConditionUtil = async (db, patientId, conditionIndex, userRef) => {
1411
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1412
- if (!doc27.exists()) throw new Error("Medical info not found");
1413
- const medicalInfo = doc27.data();
1415
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1416
+ if (!doc28.exists()) throw new Error("Medical info not found");
1417
+ const medicalInfo = doc28.data();
1414
1418
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
1415
1419
  throw new Error("Invalid blocking condition index");
1416
1420
  }
@@ -1435,9 +1439,9 @@ var addContraindicationUtil = async (db, patientId, data, userRef) => {
1435
1439
  var updateContraindicationUtil = async (db, patientId, data, userRef) => {
1436
1440
  const validatedData = updateContraindicationSchema.parse(data);
1437
1441
  const { contraindicationIndex, ...updateData } = validatedData;
1438
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1439
- if (!doc27.exists()) throw new Error("Medical info not found");
1440
- const medicalInfo = doc27.data();
1442
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1443
+ if (!doc28.exists()) throw new Error("Medical info not found");
1444
+ const medicalInfo = doc28.data();
1441
1445
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
1442
1446
  throw new Error("Invalid contraindication index");
1443
1447
  }
@@ -1453,9 +1457,9 @@ var updateContraindicationUtil = async (db, patientId, data, userRef) => {
1453
1457
  });
1454
1458
  };
1455
1459
  var removeContraindicationUtil = async (db, patientId, contraindicationIndex, userRef) => {
1456
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1457
- if (!doc27.exists()) throw new Error("Medical info not found");
1458
- const medicalInfo = doc27.data();
1460
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1461
+ if (!doc28.exists()) throw new Error("Medical info not found");
1462
+ const medicalInfo = doc28.data();
1459
1463
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
1460
1464
  throw new Error("Invalid contraindication index");
1461
1465
  }
@@ -1480,9 +1484,9 @@ var addMedicationUtil = async (db, patientId, data, userRef) => {
1480
1484
  var updateMedicationUtil = async (db, patientId, data, userRef) => {
1481
1485
  const validatedData = updateMedicationSchema.parse(data);
1482
1486
  const { medicationIndex, ...updateData } = validatedData;
1483
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1484
- if (!doc27.exists()) throw new Error("Medical info not found");
1485
- const medicalInfo = doc27.data();
1487
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1488
+ if (!doc28.exists()) throw new Error("Medical info not found");
1489
+ const medicalInfo = doc28.data();
1486
1490
  if (medicationIndex >= medicalInfo.currentMedications.length) {
1487
1491
  throw new Error("Invalid medication index");
1488
1492
  }
@@ -1498,9 +1502,9 @@ var updateMedicationUtil = async (db, patientId, data, userRef) => {
1498
1502
  });
1499
1503
  };
1500
1504
  var removeMedicationUtil = async (db, patientId, medicationIndex, userRef) => {
1501
- const doc27 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1502
- if (!doc27.exists()) throw new Error("Medical info not found");
1503
- const medicalInfo = doc27.data();
1505
+ const doc28 = await getDoc3(getMedicalInfoDocRef(db, patientId));
1506
+ if (!doc28.exists()) throw new Error("Medical info not found");
1507
+ const medicalInfo = doc28.data();
1504
1508
  if (medicationIndex >= medicalInfo.currentMedications.length) {
1505
1509
  throw new Error("Invalid medication index");
1506
1510
  }
@@ -1560,58 +1564,36 @@ var createPatientProfileUtil = async (db, data, generateId2) => {
1560
1564
  );
1561
1565
  sensitiveInfoSuccess = true;
1562
1566
  } catch (sensitiveError) {
1563
- console.error(
1564
- `[createPatientProfileUtil] Error creating sensitive info:`,
1565
- sensitiveError
1566
- );
1567
+ console.error(`[createPatientProfileUtil] Error creating sensitive info:`, sensitiveError);
1567
1568
  }
1568
1569
  console.log(`[createPatientProfileUtil] Creating medical info document`);
1569
1570
  let medicalInfoSuccess = false;
1570
1571
  try {
1571
1572
  await ensureMedicalInfoExists(db, patientId, validatedData.userRef);
1572
- console.log(
1573
- `[createPatientProfileUtil] Medical info document created successfully`
1574
- );
1573
+ console.log(`[createPatientProfileUtil] Medical info document created successfully`);
1575
1574
  medicalInfoSuccess = true;
1576
1575
  } catch (medicalError) {
1577
- console.error(
1578
- `[createPatientProfileUtil] Error creating medical info:`,
1579
- medicalError
1580
- );
1576
+ console.error(`[createPatientProfileUtil] Error creating medical info:`, medicalError);
1581
1577
  }
1582
1578
  if (!sensitiveInfoSuccess || !medicalInfoSuccess) {
1583
- console.log(
1584
- `[createPatientProfileUtil] Using fallback method to create documents`
1585
- );
1579
+ console.log(`[createPatientProfileUtil] Using fallback method to create documents`);
1586
1580
  try {
1587
1581
  await testCreateSubDocuments(db, patientId, validatedData.userRef);
1588
- console.log(
1589
- `[createPatientProfileUtil] Fallback method completed successfully`
1590
- );
1582
+ console.log(`[createPatientProfileUtil] Fallback method completed successfully`);
1591
1583
  } catch (fallbackError) {
1592
- console.error(
1593
- `[createPatientProfileUtil] Fallback method failed:`,
1594
- fallbackError
1595
- );
1584
+ console.error(`[createPatientProfileUtil] Fallback method failed:`, fallbackError);
1596
1585
  }
1597
1586
  }
1598
1587
  console.log(`[createPatientProfileUtil] Verifying patient document exists`);
1599
1588
  const patientDoc = await getDoc4(getPatientDocRef(db, patientId));
1600
1589
  if (!patientDoc.exists()) {
1601
- console.error(
1602
- `[createPatientProfileUtil] Patient document not found after creation`
1603
- );
1590
+ console.error(`[createPatientProfileUtil] Patient document not found after creation`);
1604
1591
  throw new Error("Failed to create patient profile");
1605
1592
  }
1606
- console.log(
1607
- `[createPatientProfileUtil] Patient profile creation completed successfully`
1608
- );
1593
+ console.log(`[createPatientProfileUtil] Patient profile creation completed successfully`);
1609
1594
  return patientDoc.data();
1610
1595
  } catch (error) {
1611
- console.error(
1612
- `[createPatientProfileUtil] Error in patient profile creation:`,
1613
- error
1614
- );
1596
+ console.error(`[createPatientProfileUtil] Error in patient profile creation:`, error);
1615
1597
  if (error instanceof z7.ZodError) {
1616
1598
  throw new Error("Invalid patient data: " + error.message);
1617
1599
  }
@@ -1677,9 +1659,7 @@ var updatePatientProfileByUserRefUtil = async (db, userRef, data) => {
1677
1659
  return updatePatientProfileUtil(db, patientData.id, data);
1678
1660
  } catch (error) {
1679
1661
  const errorMessage = error instanceof Error ? error.message : String(error);
1680
- throw new Error(
1681
- `Failed to update patient profile by user ref: ${errorMessage}`
1682
- );
1662
+ throw new Error(`Failed to update patient profile by user ref: ${errorMessage}`);
1683
1663
  }
1684
1664
  };
1685
1665
  var uploadProfilePhotoUtil = async (storage, patientId, file) => {
@@ -1730,9 +1710,7 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
1730
1710
  try {
1731
1711
  console.log(`[testCreateSubDocuments] Testing sensitive info creation`);
1732
1712
  const sensitiveInfoRef = getSensitiveInfoDocRef(db, patientId);
1733
- console.log(
1734
- `[testCreateSubDocuments] Sensitive info path: ${sensitiveInfoRef.path}`
1735
- );
1713
+ console.log(`[testCreateSubDocuments] Sensitive info path: ${sensitiveInfoRef.path}`);
1736
1714
  const defaultSensitiveInfo = {
1737
1715
  patientId,
1738
1716
  userRef,
@@ -1747,14 +1725,10 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
1747
1725
  updatedAt: Timestamp3.now()
1748
1726
  };
1749
1727
  await setDoc4(sensitiveInfoRef, defaultSensitiveInfo);
1750
- console.log(
1751
- `[testCreateSubDocuments] Sensitive info document created directly`
1752
- );
1728
+ console.log(`[testCreateSubDocuments] Sensitive info document created directly`);
1753
1729
  console.log(`[testCreateSubDocuments] Testing medical info creation`);
1754
1730
  const medicalInfoRef = getMedicalInfoDocRef(db, patientId);
1755
- console.log(
1756
- `[testCreateSubDocuments] Medical info path: ${medicalInfoRef.path}`
1757
- );
1731
+ console.log(`[testCreateSubDocuments] Medical info path: ${medicalInfoRef.path}`);
1758
1732
  const defaultMedicalInfo = {
1759
1733
  ...DEFAULT_MEDICAL_INFO,
1760
1734
  patientId,
@@ -1762,9 +1736,7 @@ var testCreateSubDocuments = async (db, patientId, userRef) => {
1762
1736
  updatedBy: userRef
1763
1737
  };
1764
1738
  await setDoc4(medicalInfoRef, defaultMedicalInfo);
1765
- console.log(
1766
- `[testCreateSubDocuments] Medical info document created directly`
1767
- );
1739
+ console.log(`[testCreateSubDocuments] Medical info document created directly`);
1768
1740
  console.log(`[testCreateSubDocuments] Test completed successfully`);
1769
1741
  } catch (error) {
1770
1742
  console.error(`[testCreateSubDocuments] Error:`, error);
@@ -1778,9 +1750,7 @@ var searchPatientsUtil = async (db, params, requester) => {
1778
1750
  const patientsCollectionRef = collection2(db, PATIENTS_COLLECTION);
1779
1751
  if (requester.role === "clinic_admin") {
1780
1752
  if (!requester.associatedClinicId) {
1781
- throw new Error(
1782
- "Associated clinic ID is required for clinic admin search."
1783
- );
1753
+ throw new Error("Associated clinic ID is required for clinic admin search.");
1784
1754
  }
1785
1755
  if (params.clinicId && params.clinicId !== requester.associatedClinicId) {
1786
1756
  console.warn(
@@ -1788,19 +1758,13 @@ var searchPatientsUtil = async (db, params, requester) => {
1788
1758
  );
1789
1759
  return [];
1790
1760
  }
1791
- constraints.push(
1792
- where2("clinicIds", "array-contains", requester.associatedClinicId)
1793
- );
1761
+ constraints.push(where2("clinicIds", "array-contains", requester.associatedClinicId));
1794
1762
  if (params.practitionerId) {
1795
- constraints.push(
1796
- where2("doctorIds", "array-contains", params.practitionerId)
1797
- );
1763
+ constraints.push(where2("doctorIds", "array-contains", params.practitionerId));
1798
1764
  }
1799
1765
  } else if (requester.role === "practitioner") {
1800
1766
  if (!requester.associatedPractitionerId) {
1801
- throw new Error(
1802
- "Associated practitioner ID is required for practitioner search."
1803
- );
1767
+ throw new Error("Associated practitioner ID is required for practitioner search.");
1804
1768
  }
1805
1769
  if (params.practitionerId && params.practitionerId !== requester.associatedPractitionerId) {
1806
1770
  console.warn(
@@ -1808,9 +1772,7 @@ var searchPatientsUtil = async (db, params, requester) => {
1808
1772
  );
1809
1773
  return [];
1810
1774
  }
1811
- constraints.push(
1812
- where2("doctorIds", "array-contains", requester.associatedPractitionerId)
1813
- );
1775
+ constraints.push(where2("doctorIds", "array-contains", requester.associatedPractitionerId));
1814
1776
  if (params.clinicId) {
1815
1777
  constraints.push(where2("clinicIds", "array-contains", params.clinicId));
1816
1778
  }
@@ -1820,18 +1782,42 @@ var searchPatientsUtil = async (db, params, requester) => {
1820
1782
  try {
1821
1783
  const finalQuery = query2(patientsCollectionRef, ...constraints);
1822
1784
  const querySnapshot = await getDocs2(finalQuery);
1823
- const patients = querySnapshot.docs.map(
1824
- (doc27) => doc27.data()
1825
- );
1826
- console.log(
1827
- `[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
1828
- );
1785
+ const patients = querySnapshot.docs.map((doc28) => doc28.data());
1786
+ console.log(`[searchPatientsUtil] Found ${patients.length} patients matching criteria.`);
1829
1787
  return patients;
1830
1788
  } catch (error) {
1831
1789
  console.error("[searchPatientsUtil] Error searching patients:", error);
1832
1790
  return [];
1833
1791
  }
1834
1792
  };
1793
+ var getAllPatientsUtil = async (db, options) => {
1794
+ try {
1795
+ console.log(`[getAllPatientsUtil] Fetching patients with options:`, options);
1796
+ const patientsCollection = collection2(db, PATIENTS_COLLECTION);
1797
+ let q = query2(patientsCollection);
1798
+ if (options == null ? void 0 : options.limit) {
1799
+ q = query2(q, limit(options.limit));
1800
+ }
1801
+ if (options == null ? void 0 : options.startAfter) {
1802
+ const startAfterDoc = await getDoc4(doc3(db, PATIENTS_COLLECTION, options.startAfter));
1803
+ if (startAfterDoc.exists()) {
1804
+ q = query2(q, startAfter(startAfterDoc));
1805
+ }
1806
+ }
1807
+ const patientsSnapshot = await getDocs2(q);
1808
+ const patients = [];
1809
+ patientsSnapshot.forEach((doc28) => {
1810
+ patients.push(doc28.data());
1811
+ });
1812
+ console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
1813
+ return patients;
1814
+ } catch (error) {
1815
+ console.error(`[getAllPatientsUtil] Error fetching patients:`, error);
1816
+ throw new Error(
1817
+ `Failed to retrieve patients: ${error instanceof Error ? error.message : String(error)}`
1818
+ );
1819
+ }
1820
+ };
1835
1821
 
1836
1822
  // src/services/patient/utils/location.utils.ts
1837
1823
  import {
@@ -2075,22 +2061,11 @@ var PatientService = class extends BaseService {
2075
2061
  // Metode za rad sa medicinskim informacijama
2076
2062
  async createMedicalInfo(patientId, data) {
2077
2063
  const currentUser = await this.getCurrentUser();
2078
- await createMedicalInfoUtil(
2079
- this.db,
2080
- patientId,
2081
- data,
2082
- currentUser.uid,
2083
- currentUser.roles
2084
- );
2064
+ await createMedicalInfoUtil(this.db, patientId, data, currentUser.uid, currentUser.roles);
2085
2065
  }
2086
2066
  async getMedicalInfo(patientId) {
2087
2067
  const currentUser = await this.getCurrentUser();
2088
- return getMedicalInfoUtil(
2089
- this.db,
2090
- patientId,
2091
- currentUser.uid,
2092
- currentUser.roles
2093
- );
2068
+ return getMedicalInfoUtil(this.db, patientId, currentUser.uid, currentUser.roles);
2094
2069
  }
2095
2070
  async getMedicalInfoByUserRef(userRef) {
2096
2071
  const profile = await this.getPatientProfileByUserRef(userRef);
@@ -2122,21 +2097,11 @@ var PatientService = class extends BaseService {
2122
2097
  }
2123
2098
  async updateBlockingCondition(patientId, data) {
2124
2099
  const currentUser = await this.getCurrentUser();
2125
- await updateBlockingConditionUtil(
2126
- this.db,
2127
- patientId,
2128
- data,
2129
- currentUser.uid
2130
- );
2100
+ await updateBlockingConditionUtil(this.db, patientId, data, currentUser.uid);
2131
2101
  }
2132
2102
  async removeBlockingCondition(patientId, conditionIndex) {
2133
2103
  const currentUser = await this.getCurrentUser();
2134
- await removeBlockingConditionUtil(
2135
- this.db,
2136
- patientId,
2137
- conditionIndex,
2138
- currentUser.uid
2139
- );
2104
+ await removeBlockingConditionUtil(this.db, patientId, conditionIndex, currentUser.uid);
2140
2105
  }
2141
2106
  // Metode za rad sa kontraindikacijama
2142
2107
  async addContraindication(patientId, data) {
@@ -2149,12 +2114,7 @@ var PatientService = class extends BaseService {
2149
2114
  }
2150
2115
  async removeContraindication(patientId, contraindicationIndex) {
2151
2116
  const currentUser = await this.getCurrentUser();
2152
- await removeContraindicationUtil(
2153
- this.db,
2154
- patientId,
2155
- contraindicationIndex,
2156
- currentUser.uid
2157
- );
2117
+ await removeContraindicationUtil(this.db, patientId, contraindicationIndex, currentUser.uid);
2158
2118
  }
2159
2119
  // Metode za rad sa medikacijama
2160
2120
  async addMedication(patientId, data) {
@@ -2167,12 +2127,7 @@ var PatientService = class extends BaseService {
2167
2127
  }
2168
2128
  async removeMedication(patientId, medicationIndex) {
2169
2129
  const currentUser = await this.getCurrentUser();
2170
- await removeMedicationUtil(
2171
- this.db,
2172
- patientId,
2173
- medicationIndex,
2174
- currentUser.uid
2175
- );
2130
+ await removeMedicationUtil(this.db, patientId, medicationIndex, currentUser.uid);
2176
2131
  }
2177
2132
  // Pomoćne metode
2178
2133
  async addExpoToken(patientId, token) {
@@ -2203,9 +2158,7 @@ var PatientService = class extends BaseService {
2203
2158
  if (!this.auth.currentUser) {
2204
2159
  throw new Error("No authenticated user");
2205
2160
  }
2206
- const userDoc = await getDoc7(
2207
- doc3(this.db, "users", this.auth.currentUser.uid)
2208
- );
2161
+ const userDoc = await getDoc7(doc4(this.db, "users", this.auth.currentUser.uid));
2209
2162
  if (!userDoc.exists()) {
2210
2163
  throw new Error("User not found");
2211
2164
  }
@@ -2272,12 +2225,24 @@ var PatientService = class extends BaseService {
2272
2225
  );
2273
2226
  return searchPatientsUtil(this.db, params, requester);
2274
2227
  }
2228
+ /**
2229
+ * Gets all patient profiles.
2230
+ *
2231
+ * @param {Object} options - Optional parameters for pagination
2232
+ * @param {number} options.limit - Maximum number of profiles to return
2233
+ * @param {string} options.startAfter - The ID of the document to start after (for pagination)
2234
+ * @returns {Promise<PatientProfile[]>} A promise resolving to an array of all patient profiles.
2235
+ */
2236
+ async getAllPatients(options) {
2237
+ console.log(`[PatientService.getAllPatients] Fetching patients with options:`, options);
2238
+ return getAllPatientsUtil(this.db, options);
2239
+ }
2275
2240
  };
2276
2241
 
2277
2242
  // src/services/clinic/utils/admin.utils.ts
2278
2243
  import {
2279
2244
  collection as collection3,
2280
- doc as doc4,
2245
+ doc as doc5,
2281
2246
  getDoc as getDoc8,
2282
2247
  getDocs as getDocs3,
2283
2248
  query as query3,
@@ -2839,7 +2804,7 @@ async function createClinicAdmin(db, data, clinicGroupService) {
2839
2804
  }
2840
2805
  console.log("[CLINIC_ADMIN] Preparing admin data object");
2841
2806
  const adminData = {
2842
- id: doc4(collection3(db, CLINIC_ADMINS_COLLECTION)).id,
2807
+ id: doc5(collection3(db, CLINIC_ADMINS_COLLECTION)).id,
2843
2808
  // Generate a new ID for the admin document
2844
2809
  userRef: validatedData.userRef,
2845
2810
  clinicGroupId: clinicGroupId || "",
@@ -2874,7 +2839,7 @@ async function createClinicAdmin(db, data, clinicGroupService) {
2874
2839
  adminId: adminData.id
2875
2840
  });
2876
2841
  try {
2877
- await setDoc6(doc4(db, CLINIC_ADMINS_COLLECTION, adminData.id), adminData);
2842
+ await setDoc6(doc5(db, CLINIC_ADMINS_COLLECTION, adminData.id), adminData);
2878
2843
  console.log("[CLINIC_ADMIN] Admin saved successfully");
2879
2844
  } catch (firestoreError) {
2880
2845
  console.error(
@@ -2923,7 +2888,7 @@ async function checkClinicGroupExists(db, groupId, clinicGroupService) {
2923
2888
  return !!group;
2924
2889
  }
2925
2890
  async function getClinicAdmin(db, adminId) {
2926
- const docRef = doc4(db, CLINIC_ADMINS_COLLECTION, adminId);
2891
+ const docRef = doc5(db, CLINIC_ADMINS_COLLECTION, adminId);
2927
2892
  const docSnap = await getDoc8(docRef);
2928
2893
  if (docSnap.exists()) {
2929
2894
  return docSnap.data();
@@ -2947,7 +2912,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
2947
2912
  where3("clinicGroupId", "==", clinicGroupId)
2948
2913
  );
2949
2914
  const querySnapshot = await getDocs3(q);
2950
- return querySnapshot.docs.map((doc27) => doc27.data());
2915
+ return querySnapshot.docs.map((doc28) => doc28.data());
2951
2916
  }
2952
2917
  async function updateClinicAdmin(db, adminId, data) {
2953
2918
  const admin = await getClinicAdmin(db, adminId);
@@ -2958,7 +2923,7 @@ async function updateClinicAdmin(db, adminId, data) {
2958
2923
  ...data,
2959
2924
  updatedAt: serverTimestamp8()
2960
2925
  };
2961
- await updateDoc7(doc4(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
2926
+ await updateDoc7(doc5(db, CLINIC_ADMINS_COLLECTION, adminId), updatedData);
2962
2927
  const updatedAdmin = await getClinicAdmin(db, adminId);
2963
2928
  if (!updatedAdmin) {
2964
2929
  throw new Error("Failed to retrieve updated admin");
@@ -2970,7 +2935,7 @@ async function deleteClinicAdmin(db, adminId) {
2970
2935
  if (!admin) {
2971
2936
  throw new Error("Clinic admin not found");
2972
2937
  }
2973
- await deleteDoc(doc4(db, CLINIC_ADMINS_COLLECTION, adminId));
2938
+ await deleteDoc(doc5(db, CLINIC_ADMINS_COLLECTION, adminId));
2974
2939
  }
2975
2940
  async function addClinicToManaged(db, adminId, clinicId, requesterId, clinicService) {
2976
2941
  const admin = await getClinicAdmin(db, adminId);
@@ -3213,7 +3178,7 @@ var ClinicAdminService = class extends BaseService {
3213
3178
  // src/services/practitioner/practitioner.service.ts
3214
3179
  import {
3215
3180
  collection as collection4,
3216
- doc as doc5,
3181
+ doc as doc6,
3217
3182
  getDoc as getDoc9,
3218
3183
  getDocs as getDocs4,
3219
3184
  query as query4,
@@ -3451,7 +3416,7 @@ var PractitionerService = class extends BaseService {
3451
3416
  updatedAt: Timestamp8.now()
3452
3417
  });
3453
3418
  await setDoc7(
3454
- doc5(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
3419
+ doc6(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
3455
3420
  practitionerData
3456
3421
  );
3457
3422
  const savedPractitioner = await this.getPractitioner(practitionerData.id);
@@ -3514,7 +3479,7 @@ var PractitionerService = class extends BaseService {
3514
3479
  updatedAt: Timestamp8.now()
3515
3480
  });
3516
3481
  await setDoc7(
3517
- doc5(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
3482
+ doc6(this.db, PRACTITIONERS_COLLECTION, practitionerData.id),
3518
3483
  practitionerData
3519
3484
  );
3520
3485
  const savedPractitioner = await this.getPractitioner(practitionerData.id);
@@ -3536,7 +3501,7 @@ var PractitionerService = class extends BaseService {
3536
3501
  };
3537
3502
  practitionerTokenSchema.parse(token);
3538
3503
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
3539
- await setDoc7(doc5(this.db, tokenPath), token);
3504
+ await setDoc7(doc6(this.db, tokenPath), token);
3540
3505
  return { practitioner: savedPractitioner, token };
3541
3506
  } catch (error) {
3542
3507
  if (error instanceof z11.ZodError) {
@@ -3589,7 +3554,7 @@ var PractitionerService = class extends BaseService {
3589
3554
  };
3590
3555
  practitionerTokenSchema.parse(token);
3591
3556
  const tokenPath = `${PRACTITIONERS_COLLECTION}/${validatedData.practitionerId}/${REGISTER_TOKENS_COLLECTION}/${token.id}`;
3592
- await setDoc7(doc5(this.db, tokenPath), token);
3557
+ await setDoc7(doc6(this.db, tokenPath), token);
3593
3558
  return token;
3594
3559
  } catch (error) {
3595
3560
  if (error instanceof z11.ZodError) {
@@ -3614,7 +3579,7 @@ var PractitionerService = class extends BaseService {
3614
3579
  where4("expiresAt", ">", Timestamp8.now())
3615
3580
  );
3616
3581
  const querySnapshot = await getDocs4(q);
3617
- return querySnapshot.docs.map((doc27) => doc27.data());
3582
+ return querySnapshot.docs.map((doc28) => doc28.data());
3618
3583
  }
3619
3584
  /**
3620
3585
  * Gets a token by its string value and validates it
@@ -3650,7 +3615,7 @@ var PractitionerService = class extends BaseService {
3650
3615
  * @param userId ID of the user using the token
3651
3616
  */
3652
3617
  async markTokenAsUsed(tokenId, practitionerId, userId) {
3653
- const tokenRef = doc5(
3618
+ const tokenRef = doc6(
3654
3619
  this.db,
3655
3620
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/${REGISTER_TOKENS_COLLECTION}/${tokenId}`
3656
3621
  );
@@ -3665,7 +3630,7 @@ var PractitionerService = class extends BaseService {
3665
3630
  */
3666
3631
  async getPractitioner(practitionerId) {
3667
3632
  const practitionerDoc = await getDoc9(
3668
- doc5(this.db, PRACTITIONERS_COLLECTION, practitionerId)
3633
+ doc6(this.db, PRACTITIONERS_COLLECTION, practitionerId)
3669
3634
  );
3670
3635
  if (!practitionerDoc.exists()) {
3671
3636
  return null;
@@ -3697,7 +3662,7 @@ var PractitionerService = class extends BaseService {
3697
3662
  where4("status", "==", "active" /* ACTIVE */)
3698
3663
  );
3699
3664
  const querySnapshot = await getDocs4(q);
3700
- return querySnapshot.docs.map((doc27) => doc27.data());
3665
+ return querySnapshot.docs.map((doc28) => doc28.data());
3701
3666
  }
3702
3667
  /**
3703
3668
  * Dohvata sve zdravstvene radnike za određenu kliniku
@@ -3709,7 +3674,7 @@ var PractitionerService = class extends BaseService {
3709
3674
  where4("isActive", "==", true)
3710
3675
  );
3711
3676
  const querySnapshot = await getDocs4(q);
3712
- return querySnapshot.docs.map((doc27) => doc27.data());
3677
+ return querySnapshot.docs.map((doc28) => doc28.data());
3713
3678
  }
3714
3679
  /**
3715
3680
  * Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
@@ -3721,13 +3686,13 @@ var PractitionerService = class extends BaseService {
3721
3686
  where4("status", "==", "draft" /* DRAFT */)
3722
3687
  );
3723
3688
  const querySnapshot = await getDocs4(q);
3724
- return querySnapshot.docs.map((doc27) => doc27.data());
3689
+ return querySnapshot.docs.map((doc28) => doc28.data());
3725
3690
  }
3726
3691
  /**
3727
3692
  * Ažurira profil zdravstvenog radnika
3728
3693
  */
3729
3694
  async updatePractitioner(practitionerId, data) {
3730
- const practitionerRef = doc5(
3695
+ const practitionerRef = doc6(
3731
3696
  this.db,
3732
3697
  PRACTITIONERS_COLLECTION,
3733
3698
  practitionerId
@@ -3825,7 +3790,7 @@ var PractitionerService = class extends BaseService {
3825
3790
  if (!practitioner) {
3826
3791
  throw new Error("Practitioner not found");
3827
3792
  }
3828
- await deleteDoc2(doc5(this.db, PRACTITIONERS_COLLECTION, practitionerId));
3793
+ await deleteDoc2(doc6(this.db, PRACTITIONERS_COLLECTION, practitionerId));
3829
3794
  }
3830
3795
  /**
3831
3796
  * Validates a registration token and claims the associated draft practitioner profile
@@ -3897,13 +3862,13 @@ var UserService = class extends BaseService {
3897
3862
  updatedAt: serverTimestamp10(),
3898
3863
  lastLoginAt: serverTimestamp10()
3899
3864
  };
3900
- await setDoc8(doc6(this.db, USERS_COLLECTION, userData.uid), userData);
3865
+ await setDoc8(doc7(this.db, USERS_COLLECTION, userData.uid), userData);
3901
3866
  const profiles = await this.createProfilesForRoles(
3902
3867
  userData.uid,
3903
3868
  roles,
3904
3869
  options
3905
3870
  );
3906
- await updateDoc9(doc6(this.db, USERS_COLLECTION, userData.uid), profiles);
3871
+ await updateDoc9(doc7(this.db, USERS_COLLECTION, userData.uid), profiles);
3907
3872
  return this.getUserById(userData.uid);
3908
3873
  }
3909
3874
  /**
@@ -4006,7 +3971,7 @@ var UserService = class extends BaseService {
4006
3971
  * Dohvata korisnika po ID-u
4007
3972
  */
4008
3973
  async getUserById(uid) {
4009
- const userDoc = await getDoc10(doc6(this.db, USERS_COLLECTION, uid));
3974
+ const userDoc = await getDoc10(doc7(this.db, USERS_COLLECTION, uid));
4010
3975
  if (!userDoc.exists()) {
4011
3976
  throw USER_ERRORS.NOT_FOUND;
4012
3977
  }
@@ -4030,14 +3995,14 @@ var UserService = class extends BaseService {
4030
3995
  ];
4031
3996
  const q = query5(collection5(this.db, USERS_COLLECTION), ...constraints);
4032
3997
  const querySnapshot = await getDocs5(q);
4033
- const users = querySnapshot.docs.map((doc27) => doc27.data());
3998
+ const users = querySnapshot.docs.map((doc28) => doc28.data());
4034
3999
  return Promise.all(users.map((userData) => userSchema.parse(userData)));
4035
4000
  }
4036
4001
  /**
4037
4002
  * Ažurira timestamp poslednjeg logovanja
4038
4003
  */
4039
4004
  async updateUserLoginTimestamp(uid) {
4040
- const userRef = doc6(this.db, USERS_COLLECTION, uid);
4005
+ const userRef = doc7(this.db, USERS_COLLECTION, uid);
4041
4006
  const userDoc = await getDoc10(userRef);
4042
4007
  if (!userDoc.exists()) {
4043
4008
  throw AUTH_ERRORS.USER_NOT_FOUND;
@@ -4049,7 +4014,7 @@ var UserService = class extends BaseService {
4049
4014
  return this.getUserById(uid);
4050
4015
  }
4051
4016
  async upgradeAnonymousUser(uid, email) {
4052
- const userRef = doc6(this.db, USERS_COLLECTION, uid);
4017
+ const userRef = doc7(this.db, USERS_COLLECTION, uid);
4053
4018
  const userDoc = await getDoc10(userRef);
4054
4019
  if (!userDoc.exists()) {
4055
4020
  throw USER_ERRORS.NOT_FOUND;
@@ -4062,7 +4027,7 @@ var UserService = class extends BaseService {
4062
4027
  return this.getUserById(uid);
4063
4028
  }
4064
4029
  async updateUser(uid, updates) {
4065
- const userRef = doc6(this.db, USERS_COLLECTION, uid);
4030
+ const userRef = doc7(this.db, USERS_COLLECTION, uid);
4066
4031
  const userDoc = await getDoc10(userRef);
4067
4032
  if (!userDoc.exists()) {
4068
4033
  throw USER_ERRORS.NOT_FOUND;
@@ -4094,7 +4059,7 @@ var UserService = class extends BaseService {
4094
4059
  const user = await this.getUserById(uid);
4095
4060
  if (user.roles.includes(role)) return;
4096
4061
  const profiles = await this.createProfilesForRoles(uid, [role], options);
4097
- await updateDoc9(doc6(this.db, USERS_COLLECTION, uid), {
4062
+ await updateDoc9(doc7(this.db, USERS_COLLECTION, uid), {
4098
4063
  roles: [...user.roles, role],
4099
4064
  ...profiles,
4100
4065
  updatedAt: serverTimestamp10()
@@ -4129,14 +4094,14 @@ var UserService = class extends BaseService {
4129
4094
  }
4130
4095
  break;
4131
4096
  }
4132
- await updateDoc9(doc6(this.db, USERS_COLLECTION, uid), {
4097
+ await updateDoc9(doc7(this.db, USERS_COLLECTION, uid), {
4133
4098
  roles: user.roles.filter((r) => r !== role),
4134
4099
  updatedAt: serverTimestamp10()
4135
4100
  });
4136
4101
  }
4137
4102
  // Delete operations
4138
4103
  async deleteUser(uid) {
4139
- const userRef = doc6(this.db, USERS_COLLECTION, uid);
4104
+ const userRef = doc7(this.db, USERS_COLLECTION, uid);
4140
4105
  const userDoc = await getDoc10(userRef);
4141
4106
  if (!userDoc.exists()) {
4142
4107
  throw USER_ERRORS.NOT_FOUND;
@@ -4168,7 +4133,7 @@ var UserService = class extends BaseService {
4168
4133
  // src/services/clinic/utils/clinic-group.utils.ts
4169
4134
  import {
4170
4135
  collection as collection6,
4171
- doc as doc7,
4136
+ doc as doc8,
4172
4137
  getDoc as getDoc11,
4173
4138
  getDocs as getDocs6,
4174
4139
  query as query6,
@@ -4301,7 +4266,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
4301
4266
  }
4302
4267
  const now = Timestamp10.now();
4303
4268
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
4304
- const groupId = doc7(collection6(db, CLINIC_GROUPS_COLLECTION)).id;
4269
+ const groupId = doc8(collection6(db, CLINIC_GROUPS_COLLECTION)).id;
4305
4270
  console.log("[CLINIC_GROUP] Logo value:", {
4306
4271
  logoValue: validatedData.logo,
4307
4272
  logoType: validatedData.logo === null ? "null" : typeof validatedData.logo
@@ -4351,7 +4316,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
4351
4316
  groupId: groupData.id
4352
4317
  });
4353
4318
  try {
4354
- await setDoc9(doc7(db, CLINIC_GROUPS_COLLECTION, groupData.id), groupData);
4319
+ await setDoc9(doc8(db, CLINIC_GROUPS_COLLECTION, groupData.id), groupData);
4355
4320
  console.log("[CLINIC_GROUP] Clinic group saved successfully");
4356
4321
  } catch (firestoreError) {
4357
4322
  console.error(
@@ -4397,7 +4362,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
4397
4362
  }
4398
4363
  }
4399
4364
  async function getClinicGroup(db, groupId) {
4400
- const docRef = doc7(db, CLINIC_GROUPS_COLLECTION, groupId);
4365
+ const docRef = doc8(db, CLINIC_GROUPS_COLLECTION, groupId);
4401
4366
  const docSnap = await getDoc11(docRef);
4402
4367
  if (docSnap.exists()) {
4403
4368
  return docSnap.data();
@@ -4410,7 +4375,7 @@ async function getAllActiveGroups(db) {
4410
4375
  where6("isActive", "==", true)
4411
4376
  );
4412
4377
  const querySnapshot = await getDocs6(q);
4413
- return querySnapshot.docs.map((doc27) => doc27.data());
4378
+ return querySnapshot.docs.map((doc28) => doc28.data());
4414
4379
  }
4415
4380
  async function updateClinicGroup(db, groupId, data, app) {
4416
4381
  console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
@@ -4441,7 +4406,7 @@ async function updateClinicGroup(db, groupId, data, app) {
4441
4406
  updatedAt: Timestamp10.now()
4442
4407
  };
4443
4408
  console.log("[CLINIC_GROUP] Updating clinic group in Firestore");
4444
- await updateDoc10(doc7(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
4409
+ await updateDoc10(doc8(db, CLINIC_GROUPS_COLLECTION, groupId), updatedData);
4445
4410
  console.log("[CLINIC_GROUP] Clinic group updated successfully");
4446
4411
  const updatedGroup = await getClinicGroup(db, groupId);
4447
4412
  if (!updatedGroup) {
@@ -4787,7 +4752,7 @@ var ClinicGroupService = class extends BaseService {
4787
4752
  // src/services/clinic/utils/clinic.utils.ts
4788
4753
  import {
4789
4754
  collection as collection7,
4790
- doc as doc8,
4755
+ doc as doc9,
4791
4756
  getDoc as getDoc12,
4792
4757
  getDocs as getDocs7,
4793
4758
  query as query7,
@@ -4860,7 +4825,7 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
4860
4825
  throw geohashError;
4861
4826
  }
4862
4827
  }
4863
- const clinicId = doc8(collection7(db, CLINICS_COLLECTION)).id;
4828
+ const clinicId = doc9(collection7(db, CLINICS_COLLECTION)).id;
4864
4829
  console.log("[CLINIC] Generated clinic ID:", clinicId);
4865
4830
  console.log("[CLINIC] Processing photos");
4866
4831
  let logoUrl = null;
@@ -5012,7 +4977,7 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
5012
4977
  clinicId: clinicData.id
5013
4978
  });
5014
4979
  try {
5015
- await setDoc10(doc8(db, CLINICS_COLLECTION, clinicData.id), clinicData);
4980
+ await setDoc10(doc9(db, CLINICS_COLLECTION, clinicData.id), clinicData);
5016
4981
  console.log("[CLINIC] Clinic saved successfully");
5017
4982
  } catch (firestoreError) {
5018
4983
  console.error("[CLINIC] Error saving to Firestore:", firestoreError);
@@ -5068,7 +5033,7 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
5068
5033
  }
5069
5034
  }
5070
5035
  async function getClinic(db, clinicId) {
5071
- const docRef = doc8(db, CLINICS_COLLECTION, clinicId);
5036
+ const docRef = doc9(db, CLINICS_COLLECTION, clinicId);
5072
5037
  const docSnap = await getDoc12(docRef);
5073
5038
  if (docSnap.exists()) {
5074
5039
  return docSnap.data();
@@ -5082,7 +5047,7 @@ async function getClinicsByGroup(db, groupId) {
5082
5047
  where7("isActive", "==", true)
5083
5048
  );
5084
5049
  const querySnapshot = await getDocs7(q);
5085
- return querySnapshot.docs.map((doc27) => doc27.data());
5050
+ return querySnapshot.docs.map((doc28) => doc28.data());
5086
5051
  }
5087
5052
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
5088
5053
  console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
@@ -5241,7 +5206,7 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
5241
5206
  };
5242
5207
  console.log("[CLINIC] Updating clinic in Firestore");
5243
5208
  try {
5244
- await updateDoc11(doc8(db, CLINICS_COLLECTION, clinicId), updatedData);
5209
+ await updateDoc11(doc9(db, CLINICS_COLLECTION, clinicId), updatedData);
5245
5210
  console.log("[CLINIC] Clinic updated successfully");
5246
5211
  } catch (updateError) {
5247
5212
  console.error("[CLINIC] Error updating clinic in Firestore:", updateError);
@@ -5268,7 +5233,7 @@ async function deactivateClinic(db, clinicId, adminId, clinicAdminService) {
5268
5233
  if (!hasPermission) {
5269
5234
  throw new Error("Admin does not have permission to deactivate this clinic");
5270
5235
  }
5271
- await updateDoc11(doc8(db, CLINICS_COLLECTION, clinicId), {
5236
+ await updateDoc11(doc9(db, CLINICS_COLLECTION, clinicId), {
5272
5237
  isActive: false,
5273
5238
  updatedAt: Timestamp11.now()
5274
5239
  });
@@ -5294,7 +5259,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
5294
5259
  }
5295
5260
  const q = query7(collection7(db, CLINICS_COLLECTION), ...constraints);
5296
5261
  const querySnapshot = await getDocs7(q);
5297
- return querySnapshot.docs.map((doc27) => doc27.data());
5262
+ return querySnapshot.docs.map((doc28) => doc28.data());
5298
5263
  }
5299
5264
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
5300
5265
  return getClinicsByAdmin(
@@ -5309,13 +5274,13 @@ async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGr
5309
5274
  // src/services/clinic/utils/review.utils.ts
5310
5275
  import {
5311
5276
  collection as collection8,
5312
- doc as doc9,
5277
+ doc as doc10,
5313
5278
  Timestamp as Timestamp12,
5314
5279
  getDoc as getDoc13,
5315
5280
  addDoc as addDoc2
5316
5281
  } from "firebase/firestore";
5317
5282
  async function addReview(db, clinicId, review, app) {
5318
- const clinicRef = doc9(db, "clinics", clinicId);
5283
+ const clinicRef = doc10(db, "clinics", clinicId);
5319
5284
  const clinicSnap = await getDoc13(clinicRef);
5320
5285
  if (!clinicSnap.exists()) {
5321
5286
  throw new Error("Clinic not found");
@@ -5324,7 +5289,7 @@ async function addReview(db, clinicId, review, app) {
5324
5289
  const now = Timestamp12.now();
5325
5290
  const reviewData = {
5326
5291
  ...review,
5327
- id: doc9(collection8(db, "clinic_reviews")).id,
5292
+ id: doc10(collection8(db, "clinic_reviews")).id,
5328
5293
  clinicId,
5329
5294
  createdAt: now,
5330
5295
  updatedAt: now,
@@ -5447,8 +5412,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
5447
5412
  }
5448
5413
  const q = query8(collection9(db, CLINICS_COLLECTION), ...constraints);
5449
5414
  const querySnapshot = await getDocs8(q);
5450
- for (const doc27 of querySnapshot.docs) {
5451
- const clinic = doc27.data();
5415
+ for (const doc28 of querySnapshot.docs) {
5416
+ const clinic = doc28.data();
5452
5417
  const distance = distanceBetween(
5453
5418
  [center.latitude, center.longitude],
5454
5419
  [clinic.location.latitude, clinic.location.longitude]
@@ -6312,7 +6277,7 @@ var AuthService = class extends BaseService {
6312
6277
  // src/services/notifications/notification.service.ts
6313
6278
  import {
6314
6279
  collection as collection11,
6315
- doc as doc11,
6280
+ doc as doc12,
6316
6281
  getDoc as getDoc15,
6317
6282
  getDocs as getDocs10,
6318
6283
  query as query10,
@@ -6369,7 +6334,7 @@ var NotificationService = class extends BaseService {
6369
6334
  * Dohvata notifikaciju po ID-u
6370
6335
  */
6371
6336
  async getNotification(notificationId) {
6372
- const notificationRef = doc11(
6337
+ const notificationRef = doc12(
6373
6338
  this.db,
6374
6339
  NOTIFICATIONS_COLLECTION,
6375
6340
  notificationId
@@ -6393,9 +6358,9 @@ var NotificationService = class extends BaseService {
6393
6358
  orderBy("notificationTime", "desc")
6394
6359
  );
6395
6360
  const querySnapshot = await getDocs10(q);
6396
- return querySnapshot.docs.map((doc27) => ({
6397
- id: doc27.id,
6398
- ...doc27.data()
6361
+ return querySnapshot.docs.map((doc28) => ({
6362
+ id: doc28.id,
6363
+ ...doc28.data()
6399
6364
  }));
6400
6365
  }
6401
6366
  /**
@@ -6409,16 +6374,16 @@ var NotificationService = class extends BaseService {
6409
6374
  orderBy("notificationTime", "desc")
6410
6375
  );
6411
6376
  const querySnapshot = await getDocs10(q);
6412
- return querySnapshot.docs.map((doc27) => ({
6413
- id: doc27.id,
6414
- ...doc27.data()
6377
+ return querySnapshot.docs.map((doc28) => ({
6378
+ id: doc28.id,
6379
+ ...doc28.data()
6415
6380
  }));
6416
6381
  }
6417
6382
  /**
6418
6383
  * Označava notifikaciju kao pročitanu
6419
6384
  */
6420
6385
  async markAsRead(notificationId) {
6421
- const notificationRef = doc11(
6386
+ const notificationRef = doc12(
6422
6387
  this.db,
6423
6388
  NOTIFICATIONS_COLLECTION,
6424
6389
  notificationId
@@ -6435,7 +6400,7 @@ var NotificationService = class extends BaseService {
6435
6400
  const notifications = await this.getUnreadNotifications(userId);
6436
6401
  const batch = writeBatch3(this.db);
6437
6402
  notifications.forEach((notification) => {
6438
- const notificationRef = doc11(
6403
+ const notificationRef = doc12(
6439
6404
  this.db,
6440
6405
  NOTIFICATIONS_COLLECTION,
6441
6406
  notification.id
@@ -6451,7 +6416,7 @@ var NotificationService = class extends BaseService {
6451
6416
  * Ažurira status notifikacije
6452
6417
  */
6453
6418
  async updateNotificationStatus(notificationId, status) {
6454
- const notificationRef = doc11(
6419
+ const notificationRef = doc12(
6455
6420
  this.db,
6456
6421
  NOTIFICATIONS_COLLECTION,
6457
6422
  notificationId
@@ -6465,7 +6430,7 @@ var NotificationService = class extends BaseService {
6465
6430
  * Briše notifikaciju
6466
6431
  */
6467
6432
  async deleteNotification(notificationId) {
6468
- const notificationRef = doc11(
6433
+ const notificationRef = doc12(
6469
6434
  this.db,
6470
6435
  NOTIFICATIONS_COLLECTION,
6471
6436
  notificationId
@@ -6483,9 +6448,9 @@ var NotificationService = class extends BaseService {
6483
6448
  orderBy("notificationTime", "desc")
6484
6449
  );
6485
6450
  const querySnapshot = await getDocs10(q);
6486
- return querySnapshot.docs.map((doc27) => ({
6487
- id: doc27.id,
6488
- ...doc27.data()
6451
+ return querySnapshot.docs.map((doc28) => ({
6452
+ id: doc28.id,
6453
+ ...doc28.data()
6489
6454
  }));
6490
6455
  }
6491
6456
  /**
@@ -6498,9 +6463,9 @@ var NotificationService = class extends BaseService {
6498
6463
  orderBy("notificationTime", "desc")
6499
6464
  );
6500
6465
  const querySnapshot = await getDocs10(q);
6501
- return querySnapshot.docs.map((doc27) => ({
6502
- id: doc27.id,
6503
- ...doc27.data()
6466
+ return querySnapshot.docs.map((doc28) => ({
6467
+ id: doc28.id,
6468
+ ...doc28.data()
6504
6469
  }));
6505
6470
  }
6506
6471
  };
@@ -6508,7 +6473,7 @@ var NotificationService = class extends BaseService {
6508
6473
  // src/services/procedure/procedure.service.ts
6509
6474
  import {
6510
6475
  collection as collection12,
6511
- doc as doc12,
6476
+ doc as doc13,
6512
6477
  getDoc as getDoc16,
6513
6478
  getDocs as getDocs11,
6514
6479
  query as query11,
@@ -6624,7 +6589,7 @@ var ProcedureService = class extends BaseService {
6624
6589
  updatedAt: /* @__PURE__ */ new Date()
6625
6590
  };
6626
6591
  const id = this.generateId();
6627
- const docRef = doc12(this.db, PROCEDURES_COLLECTION, id);
6592
+ const docRef = doc13(this.db, PROCEDURES_COLLECTION, id);
6628
6593
  await setDoc13(docRef, {
6629
6594
  ...procedure,
6630
6595
  id,
@@ -6639,7 +6604,7 @@ var ProcedureService = class extends BaseService {
6639
6604
  * @returns The procedure if found, null otherwise
6640
6605
  */
6641
6606
  async getProcedure(id) {
6642
- const docRef = doc12(this.db, PROCEDURES_COLLECTION, id);
6607
+ const docRef = doc13(this.db, PROCEDURES_COLLECTION, id);
6643
6608
  const docSnap = await getDoc16(docRef);
6644
6609
  if (!docSnap.exists()) {
6645
6610
  return null;
@@ -6658,7 +6623,7 @@ var ProcedureService = class extends BaseService {
6658
6623
  where11("isActive", "==", true)
6659
6624
  );
6660
6625
  const snapshot = await getDocs11(q);
6661
- return snapshot.docs.map((doc27) => doc27.data());
6626
+ return snapshot.docs.map((doc28) => doc28.data());
6662
6627
  }
6663
6628
  /**
6664
6629
  * Gets all procedures for a practitioner
@@ -6672,7 +6637,7 @@ var ProcedureService = class extends BaseService {
6672
6637
  where11("isActive", "==", true)
6673
6638
  );
6674
6639
  const snapshot = await getDocs11(q);
6675
- return snapshot.docs.map((doc27) => doc27.data());
6640
+ return snapshot.docs.map((doc28) => doc28.data());
6676
6641
  }
6677
6642
  /**
6678
6643
  * Updates a procedure
@@ -6686,7 +6651,7 @@ var ProcedureService = class extends BaseService {
6686
6651
  if (!existingProcedure) {
6687
6652
  throw new Error(`Procedure with ID ${id} not found`);
6688
6653
  }
6689
- const docRef = doc12(this.db, PROCEDURES_COLLECTION, id);
6654
+ const docRef = doc13(this.db, PROCEDURES_COLLECTION, id);
6690
6655
  await updateDoc14(docRef, {
6691
6656
  ...validatedData,
6692
6657
  updatedAt: serverTimestamp13()
@@ -6702,7 +6667,7 @@ var ProcedureService = class extends BaseService {
6702
6667
  * @param id - The ID of the procedure to deactivate
6703
6668
  */
6704
6669
  async deactivateProcedure(id) {
6705
- const docRef = doc12(this.db, PROCEDURES_COLLECTION, id);
6670
+ const docRef = doc13(this.db, PROCEDURES_COLLECTION, id);
6706
6671
  await updateDoc14(docRef, {
6707
6672
  isActive: false,
6708
6673
  updatedAt: serverTimestamp13()
@@ -6743,7 +6708,7 @@ var ProcedureService = class extends BaseService {
6743
6708
  // src/services/documentation-templates/documentation-template.service.ts
6744
6709
  import {
6745
6710
  collection as collection13,
6746
- doc as doc13,
6711
+ doc as doc14,
6747
6712
  getDoc as getDoc17,
6748
6713
  getDocs as getDocs12,
6749
6714
  setDoc as setDoc14,
@@ -6752,8 +6717,8 @@ import {
6752
6717
  query as query12,
6753
6718
  where as where12,
6754
6719
  orderBy as orderBy2,
6755
- limit,
6756
- startAfter
6720
+ limit as limit2,
6721
+ startAfter as startAfter2
6757
6722
  } from "firebase/firestore";
6758
6723
  var DocumentationTemplateService = class extends BaseService {
6759
6724
  constructor() {
@@ -6789,7 +6754,7 @@ var DocumentationTemplateService = class extends BaseService {
6789
6754
  isActive: true,
6790
6755
  tags: validatedData.tags || []
6791
6756
  };
6792
- const docRef = doc13(this.collectionRef, templateId);
6757
+ const docRef = doc14(this.collectionRef, templateId);
6793
6758
  await setDoc14(docRef, template);
6794
6759
  return template;
6795
6760
  }
@@ -6799,7 +6764,7 @@ var DocumentationTemplateService = class extends BaseService {
6799
6764
  * @returns The template or null if not found
6800
6765
  */
6801
6766
  async getTemplateById(templateId) {
6802
- const docRef = doc13(this.collectionRef, templateId);
6767
+ const docRef = doc14(this.collectionRef, templateId);
6803
6768
  const docSnap = await getDoc17(docRef);
6804
6769
  if (!docSnap.exists()) {
6805
6770
  return null;
@@ -6831,7 +6796,7 @@ var DocumentationTemplateService = class extends BaseService {
6831
6796
  updatedAt: Date.now(),
6832
6797
  version: template.version + 1
6833
6798
  };
6834
- const docRef = doc13(this.collectionRef, templateId);
6799
+ const docRef = doc14(this.collectionRef, templateId);
6835
6800
  await updateDoc15(docRef, updateData);
6836
6801
  return {
6837
6802
  ...template,
@@ -6843,7 +6808,7 @@ var DocumentationTemplateService = class extends BaseService {
6843
6808
  * @param templateId - ID of the template to delete
6844
6809
  */
6845
6810
  async deleteTemplate(templateId) {
6846
- const docRef = doc13(this.collectionRef, templateId);
6811
+ const docRef = doc14(this.collectionRef, templateId);
6847
6812
  await deleteDoc8(docRef);
6848
6813
  }
6849
6814
  /**
@@ -6857,17 +6822,17 @@ var DocumentationTemplateService = class extends BaseService {
6857
6822
  this.collectionRef,
6858
6823
  where12("isActive", "==", true),
6859
6824
  orderBy2("updatedAt", "desc"),
6860
- limit(pageSize)
6825
+ limit2(pageSize)
6861
6826
  );
6862
6827
  if (lastDoc) {
6863
- q = query12(q, startAfter(lastDoc));
6828
+ q = query12(q, startAfter2(lastDoc));
6864
6829
  }
6865
6830
  const querySnapshot = await getDocs12(q);
6866
6831
  const templates = [];
6867
6832
  let lastVisible = null;
6868
- querySnapshot.forEach((doc27) => {
6869
- templates.push(doc27.data());
6870
- lastVisible = doc27;
6833
+ querySnapshot.forEach((doc28) => {
6834
+ templates.push(doc28.data());
6835
+ lastVisible = doc28;
6871
6836
  });
6872
6837
  return {
6873
6838
  templates,
@@ -6887,17 +6852,17 @@ var DocumentationTemplateService = class extends BaseService {
6887
6852
  where12("isActive", "==", true),
6888
6853
  where12("tags", "array-contains-any", tags),
6889
6854
  orderBy2("updatedAt", "desc"),
6890
- limit(pageSize)
6855
+ limit2(pageSize)
6891
6856
  );
6892
6857
  if (lastDoc) {
6893
- q = query12(q, startAfter(lastDoc));
6858
+ q = query12(q, startAfter2(lastDoc));
6894
6859
  }
6895
6860
  const querySnapshot = await getDocs12(q);
6896
6861
  const templates = [];
6897
6862
  let lastVisible = null;
6898
- querySnapshot.forEach((doc27) => {
6899
- templates.push(doc27.data());
6900
- lastVisible = doc27;
6863
+ querySnapshot.forEach((doc28) => {
6864
+ templates.push(doc28.data());
6865
+ lastVisible = doc28;
6901
6866
  });
6902
6867
  return {
6903
6868
  templates,
@@ -6916,17 +6881,17 @@ var DocumentationTemplateService = class extends BaseService {
6916
6881
  this.collectionRef,
6917
6882
  where12("createdBy", "==", userId),
6918
6883
  orderBy2("updatedAt", "desc"),
6919
- limit(pageSize)
6884
+ limit2(pageSize)
6920
6885
  );
6921
6886
  if (lastDoc) {
6922
- q = query12(q, startAfter(lastDoc));
6887
+ q = query12(q, startAfter2(lastDoc));
6923
6888
  }
6924
6889
  const querySnapshot = await getDocs12(q);
6925
6890
  const templates = [];
6926
6891
  let lastVisible = null;
6927
- querySnapshot.forEach((doc27) => {
6928
- templates.push(doc27.data());
6929
- lastVisible = doc27;
6892
+ querySnapshot.forEach((doc28) => {
6893
+ templates.push(doc28.data());
6894
+ lastVisible = doc28;
6930
6895
  });
6931
6896
  return {
6932
6897
  templates,
@@ -6938,7 +6903,7 @@ var DocumentationTemplateService = class extends BaseService {
6938
6903
  // src/services/documentation-templates/filled-document.service.ts
6939
6904
  import {
6940
6905
  collection as collection14,
6941
- doc as doc14,
6906
+ doc as doc15,
6942
6907
  getDoc as getDoc18,
6943
6908
  getDocs as getDocs13,
6944
6909
  setDoc as setDoc15,
@@ -6946,8 +6911,8 @@ import {
6946
6911
  query as query13,
6947
6912
  where as where13,
6948
6913
  orderBy as orderBy3,
6949
- limit as limit2,
6950
- startAfter as startAfter2
6914
+ limit as limit3,
6915
+ startAfter as startAfter3
6951
6916
  } from "firebase/firestore";
6952
6917
  var FilledDocumentService = class extends BaseService {
6953
6918
  constructor(...args) {
@@ -6985,7 +6950,7 @@ var FilledDocumentService = class extends BaseService {
6985
6950
  values: {},
6986
6951
  status: "draft" /* DRAFT */
6987
6952
  };
6988
- const docRef = doc14(this.collectionRef, documentId);
6953
+ const docRef = doc15(this.collectionRef, documentId);
6989
6954
  await setDoc15(docRef, filledDocument);
6990
6955
  return filledDocument;
6991
6956
  }
@@ -6995,7 +6960,7 @@ var FilledDocumentService = class extends BaseService {
6995
6960
  * @returns The filled document or null if not found
6996
6961
  */
6997
6962
  async getFilledDocumentById(documentId) {
6998
- const docRef = doc14(this.collectionRef, documentId);
6963
+ const docRef = doc15(this.collectionRef, documentId);
6999
6964
  const docSnap = await getDoc18(docRef);
7000
6965
  if (!docSnap.exists()) {
7001
6966
  return null;
@@ -7024,7 +6989,7 @@ var FilledDocumentService = class extends BaseService {
7024
6989
  if (status) {
7025
6990
  updateData.status = status;
7026
6991
  }
7027
- const docRef = doc14(this.collectionRef, documentId);
6992
+ const docRef = doc15(this.collectionRef, documentId);
7028
6993
  await updateDoc16(docRef, updateData);
7029
6994
  return {
7030
6995
  ...filledDocument,
@@ -7043,17 +7008,17 @@ var FilledDocumentService = class extends BaseService {
7043
7008
  this.collectionRef,
7044
7009
  where13("patientId", "==", patientId),
7045
7010
  orderBy3("updatedAt", "desc"),
7046
- limit2(pageSize)
7011
+ limit3(pageSize)
7047
7012
  );
7048
7013
  if (lastDoc) {
7049
- q = query13(q, startAfter2(lastDoc));
7014
+ q = query13(q, startAfter3(lastDoc));
7050
7015
  }
7051
7016
  const querySnapshot = await getDocs13(q);
7052
7017
  const documents = [];
7053
7018
  let lastVisible = null;
7054
- querySnapshot.forEach((doc27) => {
7055
- documents.push(doc27.data());
7056
- lastVisible = doc27;
7019
+ querySnapshot.forEach((doc28) => {
7020
+ documents.push(doc28.data());
7021
+ lastVisible = doc28;
7057
7022
  });
7058
7023
  return {
7059
7024
  documents,
@@ -7072,17 +7037,17 @@ var FilledDocumentService = class extends BaseService {
7072
7037
  this.collectionRef,
7073
7038
  where13("practitionerId", "==", practitionerId),
7074
7039
  orderBy3("updatedAt", "desc"),
7075
- limit2(pageSize)
7040
+ limit3(pageSize)
7076
7041
  );
7077
7042
  if (lastDoc) {
7078
- q = query13(q, startAfter2(lastDoc));
7043
+ q = query13(q, startAfter3(lastDoc));
7079
7044
  }
7080
7045
  const querySnapshot = await getDocs13(q);
7081
7046
  const documents = [];
7082
7047
  let lastVisible = null;
7083
- querySnapshot.forEach((doc27) => {
7084
- documents.push(doc27.data());
7085
- lastVisible = doc27;
7048
+ querySnapshot.forEach((doc28) => {
7049
+ documents.push(doc28.data());
7050
+ lastVisible = doc28;
7086
7051
  });
7087
7052
  return {
7088
7053
  documents,
@@ -7101,17 +7066,17 @@ var FilledDocumentService = class extends BaseService {
7101
7066
  this.collectionRef,
7102
7067
  where13("clinicId", "==", clinicId),
7103
7068
  orderBy3("updatedAt", "desc"),
7104
- limit2(pageSize)
7069
+ limit3(pageSize)
7105
7070
  );
7106
7071
  if (lastDoc) {
7107
- q = query13(q, startAfter2(lastDoc));
7072
+ q = query13(q, startAfter3(lastDoc));
7108
7073
  }
7109
7074
  const querySnapshot = await getDocs13(q);
7110
7075
  const documents = [];
7111
7076
  let lastVisible = null;
7112
- querySnapshot.forEach((doc27) => {
7113
- documents.push(doc27.data());
7114
- lastVisible = doc27;
7077
+ querySnapshot.forEach((doc28) => {
7078
+ documents.push(doc28.data());
7079
+ lastVisible = doc28;
7115
7080
  });
7116
7081
  return {
7117
7082
  documents,
@@ -7130,17 +7095,17 @@ var FilledDocumentService = class extends BaseService {
7130
7095
  this.collectionRef,
7131
7096
  where13("templateId", "==", templateId),
7132
7097
  orderBy3("updatedAt", "desc"),
7133
- limit2(pageSize)
7098
+ limit3(pageSize)
7134
7099
  );
7135
7100
  if (lastDoc) {
7136
- q = query13(q, startAfter2(lastDoc));
7101
+ q = query13(q, startAfter3(lastDoc));
7137
7102
  }
7138
7103
  const querySnapshot = await getDocs13(q);
7139
7104
  const documents = [];
7140
7105
  let lastVisible = null;
7141
- querySnapshot.forEach((doc27) => {
7142
- documents.push(doc27.data());
7143
- lastVisible = doc27;
7106
+ querySnapshot.forEach((doc28) => {
7107
+ documents.push(doc28.data());
7108
+ lastVisible = doc28;
7144
7109
  });
7145
7110
  return {
7146
7111
  documents,
@@ -7159,17 +7124,17 @@ var FilledDocumentService = class extends BaseService {
7159
7124
  this.collectionRef,
7160
7125
  where13("status", "==", status),
7161
7126
  orderBy3("updatedAt", "desc"),
7162
- limit2(pageSize)
7127
+ limit3(pageSize)
7163
7128
  );
7164
7129
  if (lastDoc) {
7165
- q = query13(q, startAfter2(lastDoc));
7130
+ q = query13(q, startAfter3(lastDoc));
7166
7131
  }
7167
7132
  const querySnapshot = await getDocs13(q);
7168
7133
  const documents = [];
7169
7134
  let lastVisible = null;
7170
- querySnapshot.forEach((doc27) => {
7171
- documents.push(doc27.data());
7172
- lastVisible = doc27;
7135
+ querySnapshot.forEach((doc28) => {
7136
+ documents.push(doc28.data());
7137
+ lastVisible = doc28;
7173
7138
  });
7174
7139
  return {
7175
7140
  documents,
@@ -7192,7 +7157,7 @@ var SYNCED_CALENDARS_COLLECTION = "syncedCalendars";
7192
7157
 
7193
7158
  // src/services/calendar/calendar-refactored.service.ts
7194
7159
  import {
7195
- doc as doc21,
7160
+ doc as doc22,
7196
7161
  getDoc as getDoc24,
7197
7162
  collection as collection20,
7198
7163
  query as query19,
@@ -7379,7 +7344,7 @@ var calendarEventSchema = z18.object({
7379
7344
  // src/services/calendar/utils/clinic.utils.ts
7380
7345
  import {
7381
7346
  collection as collection15,
7382
- doc as doc16,
7347
+ doc as doc17,
7383
7348
  getDoc as getDoc19,
7384
7349
  getDocs as getDocs14,
7385
7350
  setDoc as setDoc16,
@@ -7393,39 +7358,39 @@ import {
7393
7358
  } from "firebase/firestore";
7394
7359
 
7395
7360
  // src/services/calendar/utils/docs.utils.ts
7396
- import { doc as doc15 } from "firebase/firestore";
7361
+ import { doc as doc16 } from "firebase/firestore";
7397
7362
  function getPractitionerCalendarEventDocRef(db, practitionerId, eventId) {
7398
- return doc15(
7363
+ return doc16(
7399
7364
  db,
7400
7365
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/${CALENDAR_COLLECTION}/${eventId}`
7401
7366
  );
7402
7367
  }
7403
7368
  function getPatientCalendarEventDocRef(db, patientId, eventId) {
7404
- return doc15(
7369
+ return doc16(
7405
7370
  db,
7406
7371
  `${PATIENTS_COLLECTION}/${patientId}/${CALENDAR_COLLECTION}/${eventId}`
7407
7372
  );
7408
7373
  }
7409
7374
  function getClinicCalendarEventDocRef(db, clinicId, eventId) {
7410
- return doc15(
7375
+ return doc16(
7411
7376
  db,
7412
7377
  `${CLINICS_COLLECTION}/${clinicId}/${CALENDAR_COLLECTION}/${eventId}`
7413
7378
  );
7414
7379
  }
7415
7380
  function getPractitionerSyncedCalendarDocRef(db, practitionerId, syncedCalendarId) {
7416
- return doc15(
7381
+ return doc16(
7417
7382
  db,
7418
7383
  `${PRACTITIONERS_COLLECTION}/${practitionerId}/syncedCalendars/${syncedCalendarId}`
7419
7384
  );
7420
7385
  }
7421
7386
  function getPatientSyncedCalendarDocRef(db, patientId, syncedCalendarId) {
7422
- return doc15(
7387
+ return doc16(
7423
7388
  db,
7424
7389
  `${PATIENTS_COLLECTION}/${patientId}/syncedCalendars/${syncedCalendarId}`
7425
7390
  );
7426
7391
  }
7427
7392
  function getClinicSyncedCalendarDocRef(db, clinicId, syncedCalendarId) {
7428
- return doc15(
7393
+ return doc16(
7429
7394
  db,
7430
7395
  `${CLINICS_COLLECTION}/${clinicId}/syncedCalendars/${syncedCalendarId}`
7431
7396
  );
@@ -7462,7 +7427,7 @@ async function updateClinicCalendarEventUtil(db, clinicId, eventId, updateData)
7462
7427
  return updatedDoc.data();
7463
7428
  }
7464
7429
  async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
7465
- const clinicDoc = await getDoc19(doc16(db, `clinics/${clinicId}`));
7430
+ const clinicDoc = await getDoc19(doc17(db, `clinics/${clinicId}`));
7466
7431
  if (!clinicDoc.exists()) {
7467
7432
  throw new Error(`Clinic with ID ${clinicId} not found`);
7468
7433
  }
@@ -7472,7 +7437,7 @@ async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
7472
7437
  return false;
7473
7438
  }
7474
7439
  const clinicGroupDoc = await getDoc19(
7475
- doc16(db, `${CLINIC_GROUPS_COLLECTION}/${clinicGroupId}`)
7440
+ doc17(db, `${CLINIC_GROUPS_COLLECTION}/${clinicGroupId}`)
7476
7441
  );
7477
7442
  if (!clinicGroupDoc.exists()) {
7478
7443
  return false;
@@ -7648,7 +7613,7 @@ async function updateAppointmentUtil(db, clinicId, practitionerId, patientId, ev
7648
7613
  // src/services/calendar/utils/calendar-event.utils.ts
7649
7614
  import {
7650
7615
  collection as collection18,
7651
- doc as doc19,
7616
+ doc as doc20,
7652
7617
  getDoc as getDoc22,
7653
7618
  getDocs as getDocs17,
7654
7619
  setDoc as setDoc19,
@@ -7701,7 +7666,7 @@ async function searchCalendarEventsUtil(db, params) {
7701
7666
  "Clinic ID (entityId) is required when searching clinic-related events."
7702
7667
  );
7703
7668
  }
7704
- baseCollectionPath = CALENDAR_COLLECTION;
7669
+ baseCollectionPath = `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
7705
7670
  constraints.push(where17("clinicBranchId", "==", entityId));
7706
7671
  if (filters.clinicId && filters.clinicId !== entityId) {
7707
7672
  console.warn(
@@ -7743,7 +7708,7 @@ async function searchCalendarEventsUtil(db, params) {
7743
7708
  const finalQuery = query17(collectionRef, ...constraints);
7744
7709
  const querySnapshot = await getDocs17(finalQuery);
7745
7710
  const events = querySnapshot.docs.map(
7746
- (doc27) => ({ id: doc27.id, ...doc27.data() })
7711
+ (doc28) => ({ id: doc28.id, ...doc28.data() })
7747
7712
  );
7748
7713
  return events;
7749
7714
  } catch (error) {
@@ -7836,7 +7801,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
7836
7801
  );
7837
7802
  const q = query18(calendarsRef, orderBy8("createdAt", "desc"));
7838
7803
  const querySnapshot = await getDocs18(q);
7839
- return querySnapshot.docs.map((doc27) => doc27.data());
7804
+ return querySnapshot.docs.map((doc28) => doc28.data());
7840
7805
  }
7841
7806
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
7842
7807
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
@@ -7853,7 +7818,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
7853
7818
  );
7854
7819
  const q = query18(calendarsRef, orderBy8("createdAt", "desc"));
7855
7820
  const querySnapshot = await getDocs18(q);
7856
- return querySnapshot.docs.map((doc27) => doc27.data());
7821
+ return querySnapshot.docs.map((doc28) => doc28.data());
7857
7822
  }
7858
7823
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
7859
7824
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
@@ -7870,7 +7835,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
7870
7835
  );
7871
7836
  const q = query18(calendarsRef, orderBy8("createdAt", "desc"));
7872
7837
  const querySnapshot = await getDocs18(q);
7873
- return querySnapshot.docs.map((doc27) => doc27.data());
7838
+ return querySnapshot.docs.map((doc28) => doc28.data());
7874
7839
  }
7875
7840
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
7876
7841
  const calendarRef = getPractitionerSyncedCalendarDocRef(
@@ -9118,7 +9083,7 @@ var CalendarServiceV2 = class extends BaseService {
9118
9083
  async createDoctorBlockingEvent(doctorId, eventData) {
9119
9084
  try {
9120
9085
  const eventId = this.generateId();
9121
- const eventRef = doc21(
9086
+ const eventRef = doc22(
9122
9087
  this.db,
9123
9088
  PRACTITIONERS_COLLECTION,
9124
9089
  doctorId,
@@ -9225,9 +9190,9 @@ var CalendarServiceV2 = class extends BaseService {
9225
9190
  where19("eventTime.start", "<=", Timestamp25.fromDate(endDate))
9226
9191
  );
9227
9192
  const eventsSnapshot = await getDocs19(q);
9228
- const events = eventsSnapshot.docs.map((doc27) => ({
9229
- id: doc27.id,
9230
- ...doc27.data()
9193
+ const events = eventsSnapshot.docs.map((doc28) => ({
9194
+ id: doc28.id,
9195
+ ...doc28.data()
9231
9196
  }));
9232
9197
  const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
9233
9198
  doctorId
@@ -9331,7 +9296,7 @@ var CalendarServiceV2 = class extends BaseService {
9331
9296
  const endTime = new Date(
9332
9297
  externalEvent.end.dateTime || externalEvent.end.date
9333
9298
  );
9334
- const eventRef = doc21(
9299
+ const eventRef = doc22(
9335
9300
  this.db,
9336
9301
  PRACTITIONERS_COLLECTION,
9337
9302
  doctorId,
@@ -9363,7 +9328,7 @@ var CalendarServiceV2 = class extends BaseService {
9363
9328
  */
9364
9329
  async updateEventStatus(doctorId, eventId, status) {
9365
9330
  try {
9366
- const eventRef = doc21(
9331
+ const eventRef = doc22(
9367
9332
  this.db,
9368
9333
  PRACTITIONERS_COLLECTION,
9369
9334
  doctorId,
@@ -9529,7 +9494,7 @@ var CalendarServiceV2 = class extends BaseService {
9529
9494
  const startDate = eventTime.start.toDate();
9530
9495
  const startTime = startDate;
9531
9496
  const endTime = eventTime.end.toDate();
9532
- const practitionerRef = doc21(this.db, PRACTITIONERS_COLLECTION, doctorId);
9497
+ const practitionerRef = doc22(this.db, PRACTITIONERS_COLLECTION, doctorId);
9533
9498
  const practitionerDoc = await getDoc24(practitionerRef);
9534
9499
  if (!practitionerDoc.exists()) {
9535
9500
  throw new Error(`Doctor with ID ${doctorId} not found`);
@@ -9587,7 +9552,7 @@ var CalendarServiceV2 = class extends BaseService {
9587
9552
  * @returns Updated calendar event
9588
9553
  */
9589
9554
  async updateAppointmentStatus(appointmentId, clinicId, status) {
9590
- const appointmentRef = doc21(this.db, CALENDAR_COLLECTION, appointmentId);
9555
+ const appointmentRef = doc22(this.db, CALENDAR_COLLECTION, appointmentId);
9591
9556
  const appointmentDoc = await getDoc24(appointmentRef);
9592
9557
  if (!appointmentDoc.exists()) {
9593
9558
  throw new Error(`Appointment with ID ${appointmentId} not found`);
@@ -9743,7 +9708,7 @@ var CalendarServiceV2 = class extends BaseService {
9743
9708
  async updateEventWithSyncId(entityId, entityType, eventId, syncEvent) {
9744
9709
  try {
9745
9710
  const collectionPath = entityType === "doctor" ? `${PRACTITIONERS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}` : `${PATIENTS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
9746
- const eventRef = doc21(this.db, collectionPath, eventId);
9711
+ const eventRef = doc22(this.db, collectionPath, eventId);
9747
9712
  const eventDoc = await getDoc24(eventRef);
9748
9713
  if (eventDoc.exists()) {
9749
9714
  const event = eventDoc.data();
@@ -9782,7 +9747,7 @@ var CalendarServiceV2 = class extends BaseService {
9782
9747
  * @returns Working hours for the clinic
9783
9748
  */
9784
9749
  async getClinicWorkingHours(clinicId, date) {
9785
- const clinicRef = doc21(this.db, CLINICS_COLLECTION, clinicId);
9750
+ const clinicRef = doc22(this.db, CLINICS_COLLECTION, clinicId);
9786
9751
  const clinicDoc = await getDoc24(clinicRef);
9787
9752
  if (!clinicDoc.exists()) {
9788
9753
  throw new Error(`Clinic with ID ${clinicId} not found`);
@@ -9811,7 +9776,7 @@ var CalendarServiceV2 = class extends BaseService {
9811
9776
  * @returns Doctor's schedule
9812
9777
  */
9813
9778
  async getDoctorSchedule(doctorId, date) {
9814
- const practitionerRef = doc21(this.db, PRACTITIONERS_COLLECTION, doctorId);
9779
+ const practitionerRef = doc22(this.db, PRACTITIONERS_COLLECTION, doctorId);
9815
9780
  const practitionerDoc = await getDoc24(practitionerRef);
9816
9781
  if (!practitionerDoc.exists()) {
9817
9782
  throw new Error(`Doctor with ID ${doctorId} not found`);
@@ -9856,7 +9821,7 @@ var CalendarServiceV2 = class extends BaseService {
9856
9821
  ])
9857
9822
  );
9858
9823
  const querySnapshot = await getDocs19(q);
9859
- return querySnapshot.docs.map((doc27) => doc27.data());
9824
+ return querySnapshot.docs.map((doc28) => doc28.data());
9860
9825
  }
9861
9826
  /**
9862
9827
  * Calculates available time slots based on working hours, schedule and existing appointments
@@ -9913,11 +9878,11 @@ var CalendarServiceV2 = class extends BaseService {
9913
9878
  var _a;
9914
9879
  try {
9915
9880
  const [clinicDoc, practitionerDoc, patientDoc, patientSensitiveInfoDoc] = await Promise.all([
9916
- getDoc24(doc21(this.db, CLINICS_COLLECTION, clinicId)),
9917
- getDoc24(doc21(this.db, PRACTITIONERS_COLLECTION, doctorId)),
9918
- getDoc24(doc21(this.db, PATIENTS_COLLECTION, patientId)),
9881
+ getDoc24(doc22(this.db, CLINICS_COLLECTION, clinicId)),
9882
+ getDoc24(doc22(this.db, PRACTITIONERS_COLLECTION, doctorId)),
9883
+ getDoc24(doc22(this.db, PATIENTS_COLLECTION, patientId)),
9919
9884
  getDoc24(
9920
- doc21(
9885
+ doc22(
9921
9886
  this.db,
9922
9887
  PATIENTS_COLLECTION,
9923
9888
  patientId,
@@ -9984,7 +9949,7 @@ var CalendarServiceV2 = class extends BaseService {
9984
9949
  import {
9985
9950
  addDoc as addDoc4,
9986
9951
  collection as collection21,
9987
- doc as doc22,
9952
+ doc as doc23,
9988
9953
  getDoc as getDoc25,
9989
9954
  getDocs as getDocs20,
9990
9955
  query as query20,
@@ -10024,9 +9989,9 @@ var BrandService = class extends BaseService {
10024
9989
  const q = query20(this.getBrandsRef(), where20("isActive", "==", true));
10025
9990
  const snapshot = await getDocs20(q);
10026
9991
  return snapshot.docs.map(
10027
- (doc27) => ({
10028
- id: doc27.id,
10029
- ...doc27.data()
9992
+ (doc28) => ({
9993
+ id: doc28.id,
9994
+ ...doc28.data()
10030
9995
  })
10031
9996
  );
10032
9997
  }
@@ -10038,7 +10003,7 @@ var BrandService = class extends BaseService {
10038
10003
  ...brand,
10039
10004
  updatedAt: /* @__PURE__ */ new Date()
10040
10005
  };
10041
- const docRef = doc22(this.getBrandsRef(), brandId);
10006
+ const docRef = doc23(this.getBrandsRef(), brandId);
10042
10007
  await updateDoc23(docRef, updateData);
10043
10008
  return this.getById(brandId);
10044
10009
  }
@@ -10054,7 +10019,7 @@ var BrandService = class extends BaseService {
10054
10019
  * Gets a brand by ID
10055
10020
  */
10056
10021
  async getById(brandId) {
10057
- const docRef = doc22(this.getBrandsRef(), brandId);
10022
+ const docRef = doc23(this.getBrandsRef(), brandId);
10058
10023
  const docSnap = await getDoc25(docRef);
10059
10024
  if (!docSnap.exists()) return null;
10060
10025
  return {
@@ -10068,7 +10033,7 @@ var BrandService = class extends BaseService {
10068
10033
  import {
10069
10034
  addDoc as addDoc5,
10070
10035
  collection as collection22,
10071
- doc as doc23,
10036
+ doc as doc24,
10072
10037
  getDoc as getDoc26,
10073
10038
  getDocs as getDocs21,
10074
10039
  query as query21,
@@ -10111,9 +10076,9 @@ var CategoryService = class extends BaseService {
10111
10076
  const q = query21(this.categoriesRef, where21("isActive", "==", true));
10112
10077
  const snapshot = await getDocs21(q);
10113
10078
  return snapshot.docs.map(
10114
- (doc27) => ({
10115
- id: doc27.id,
10116
- ...doc27.data()
10079
+ (doc28) => ({
10080
+ id: doc28.id,
10081
+ ...doc28.data()
10117
10082
  })
10118
10083
  );
10119
10084
  }
@@ -10130,9 +10095,9 @@ var CategoryService = class extends BaseService {
10130
10095
  );
10131
10096
  const snapshot = await getDocs21(q);
10132
10097
  return snapshot.docs.map(
10133
- (doc27) => ({
10134
- id: doc27.id,
10135
- ...doc27.data()
10098
+ (doc28) => ({
10099
+ id: doc28.id,
10100
+ ...doc28.data()
10136
10101
  })
10137
10102
  );
10138
10103
  }
@@ -10147,7 +10112,7 @@ var CategoryService = class extends BaseService {
10147
10112
  ...category,
10148
10113
  updatedAt: /* @__PURE__ */ new Date()
10149
10114
  };
10150
- const docRef = doc23(this.categoriesRef, id);
10115
+ const docRef = doc24(this.categoriesRef, id);
10151
10116
  await updateDoc24(docRef, updateData);
10152
10117
  return this.getById(id);
10153
10118
  }
@@ -10164,7 +10129,7 @@ var CategoryService = class extends BaseService {
10164
10129
  * @returns Kategorija ili null ako ne postoji
10165
10130
  */
10166
10131
  async getById(id) {
10167
- const docRef = doc23(this.categoriesRef, id);
10132
+ const docRef = doc24(this.categoriesRef, id);
10168
10133
  const docSnap = await getDoc26(docRef);
10169
10134
  if (!docSnap.exists()) return null;
10170
10135
  return {
@@ -10178,7 +10143,7 @@ var CategoryService = class extends BaseService {
10178
10143
  import {
10179
10144
  addDoc as addDoc6,
10180
10145
  collection as collection23,
10181
- doc as doc24,
10146
+ doc as doc25,
10182
10147
  getDoc as getDoc27,
10183
10148
  getDocs as getDocs22,
10184
10149
  query as query22,
@@ -10236,9 +10201,9 @@ var SubcategoryService = class extends BaseService {
10236
10201
  );
10237
10202
  const snapshot = await getDocs22(q);
10238
10203
  return snapshot.docs.map(
10239
- (doc27) => ({
10240
- id: doc27.id,
10241
- ...doc27.data()
10204
+ (doc28) => ({
10205
+ id: doc28.id,
10206
+ ...doc28.data()
10242
10207
  })
10243
10208
  );
10244
10209
  }
@@ -10254,7 +10219,7 @@ var SubcategoryService = class extends BaseService {
10254
10219
  ...subcategory,
10255
10220
  updatedAt: /* @__PURE__ */ new Date()
10256
10221
  };
10257
- const docRef = doc24(this.getSubcategoriesRef(categoryId), subcategoryId);
10222
+ const docRef = doc25(this.getSubcategoriesRef(categoryId), subcategoryId);
10258
10223
  await updateDoc25(docRef, updateData);
10259
10224
  return this.getById(categoryId, subcategoryId);
10260
10225
  }
@@ -10273,7 +10238,7 @@ var SubcategoryService = class extends BaseService {
10273
10238
  * @returns Podkategorija ili null ako ne postoji
10274
10239
  */
10275
10240
  async getById(categoryId, subcategoryId) {
10276
- const docRef = doc24(this.getSubcategoriesRef(categoryId), subcategoryId);
10241
+ const docRef = doc25(this.getSubcategoriesRef(categoryId), subcategoryId);
10277
10242
  const docSnap = await getDoc27(docRef);
10278
10243
  if (!docSnap.exists()) return null;
10279
10244
  return {
@@ -10287,7 +10252,7 @@ var SubcategoryService = class extends BaseService {
10287
10252
  import {
10288
10253
  addDoc as addDoc7,
10289
10254
  collection as collection24,
10290
- doc as doc25,
10255
+ doc as doc26,
10291
10256
  getDoc as getDoc28,
10292
10257
  getDocs as getDocs23,
10293
10258
  query as query23,
@@ -10344,9 +10309,9 @@ var TechnologyService = class extends BaseService {
10344
10309
  const q = query23(this.getTechnologiesRef(), where23("isActive", "==", true));
10345
10310
  const snapshot = await getDocs23(q);
10346
10311
  return snapshot.docs.map(
10347
- (doc27) => ({
10348
- id: doc27.id,
10349
- ...doc27.data()
10312
+ (doc28) => ({
10313
+ id: doc28.id,
10314
+ ...doc28.data()
10350
10315
  })
10351
10316
  );
10352
10317
  }
@@ -10363,9 +10328,9 @@ var TechnologyService = class extends BaseService {
10363
10328
  );
10364
10329
  const snapshot = await getDocs23(q);
10365
10330
  return snapshot.docs.map(
10366
- (doc27) => ({
10367
- id: doc27.id,
10368
- ...doc27.data()
10331
+ (doc28) => ({
10332
+ id: doc28.id,
10333
+ ...doc28.data()
10369
10334
  })
10370
10335
  );
10371
10336
  }
@@ -10382,9 +10347,9 @@ var TechnologyService = class extends BaseService {
10382
10347
  );
10383
10348
  const snapshot = await getDocs23(q);
10384
10349
  return snapshot.docs.map(
10385
- (doc27) => ({
10386
- id: doc27.id,
10387
- ...doc27.data()
10350
+ (doc28) => ({
10351
+ id: doc28.id,
10352
+ ...doc28.data()
10388
10353
  })
10389
10354
  );
10390
10355
  }
@@ -10401,9 +10366,9 @@ var TechnologyService = class extends BaseService {
10401
10366
  );
10402
10367
  const snapshot = await getDocs23(q);
10403
10368
  return snapshot.docs.map(
10404
- (doc27) => ({
10405
- id: doc27.id,
10406
- ...doc27.data()
10369
+ (doc28) => ({
10370
+ id: doc28.id,
10371
+ ...doc28.data()
10407
10372
  })
10408
10373
  );
10409
10374
  }
@@ -10418,7 +10383,7 @@ var TechnologyService = class extends BaseService {
10418
10383
  ...technology,
10419
10384
  updatedAt: /* @__PURE__ */ new Date()
10420
10385
  };
10421
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10386
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10422
10387
  await updateDoc26(docRef, updateData);
10423
10388
  return this.getById(technologyId);
10424
10389
  }
@@ -10437,7 +10402,7 @@ var TechnologyService = class extends BaseService {
10437
10402
  * @returns Tehnologija ili null ako ne postoji
10438
10403
  */
10439
10404
  async getById(technologyId) {
10440
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10405
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10441
10406
  const docSnap = await getDoc28(docRef);
10442
10407
  if (!docSnap.exists()) return null;
10443
10408
  return {
@@ -10452,7 +10417,7 @@ var TechnologyService = class extends BaseService {
10452
10417
  * @returns Ažurirana tehnologija sa novim zahtevom
10453
10418
  */
10454
10419
  async addRequirement(technologyId, requirement) {
10455
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10420
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10456
10421
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
10457
10422
  await updateDoc26(docRef, {
10458
10423
  [requirementType]: arrayUnion5(requirement),
@@ -10467,7 +10432,7 @@ var TechnologyService = class extends BaseService {
10467
10432
  * @returns Ažurirana tehnologija bez uklonjenog zahteva
10468
10433
  */
10469
10434
  async removeRequirement(technologyId, requirement) {
10470
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10435
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10471
10436
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
10472
10437
  await updateDoc26(docRef, {
10473
10438
  [requirementType]: arrayRemove4(requirement),
@@ -10507,7 +10472,7 @@ var TechnologyService = class extends BaseService {
10507
10472
  * @returns Ažurirana tehnologija
10508
10473
  */
10509
10474
  async addBlockingCondition(technologyId, condition) {
10510
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10475
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10511
10476
  await updateDoc26(docRef, {
10512
10477
  blockingConditions: arrayUnion5(condition),
10513
10478
  updatedAt: /* @__PURE__ */ new Date()
@@ -10521,7 +10486,7 @@ var TechnologyService = class extends BaseService {
10521
10486
  * @returns Ažurirana tehnologija
10522
10487
  */
10523
10488
  async removeBlockingCondition(technologyId, condition) {
10524
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10489
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10525
10490
  await updateDoc26(docRef, {
10526
10491
  blockingConditions: arrayRemove4(condition),
10527
10492
  updatedAt: /* @__PURE__ */ new Date()
@@ -10535,7 +10500,7 @@ var TechnologyService = class extends BaseService {
10535
10500
  * @returns Ažurirana tehnologija
10536
10501
  */
10537
10502
  async addContraindication(technologyId, contraindication) {
10538
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10503
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10539
10504
  await updateDoc26(docRef, {
10540
10505
  contraindications: arrayUnion5(contraindication),
10541
10506
  updatedAt: /* @__PURE__ */ new Date()
@@ -10549,7 +10514,7 @@ var TechnologyService = class extends BaseService {
10549
10514
  * @returns Ažurirana tehnologija
10550
10515
  */
10551
10516
  async removeContraindication(technologyId, contraindication) {
10552
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10517
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10553
10518
  await updateDoc26(docRef, {
10554
10519
  contraindications: arrayRemove4(contraindication),
10555
10520
  updatedAt: /* @__PURE__ */ new Date()
@@ -10563,7 +10528,7 @@ var TechnologyService = class extends BaseService {
10563
10528
  * @returns Ažurirana tehnologija
10564
10529
  */
10565
10530
  async addBenefit(technologyId, benefit) {
10566
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10531
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10567
10532
  await updateDoc26(docRef, {
10568
10533
  benefits: arrayUnion5(benefit),
10569
10534
  updatedAt: /* @__PURE__ */ new Date()
@@ -10577,7 +10542,7 @@ var TechnologyService = class extends BaseService {
10577
10542
  * @returns Ažurirana tehnologija
10578
10543
  */
10579
10544
  async removeBenefit(technologyId, benefit) {
10580
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10545
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10581
10546
  await updateDoc26(docRef, {
10582
10547
  benefits: arrayRemove4(benefit),
10583
10548
  updatedAt: /* @__PURE__ */ new Date()
@@ -10618,7 +10583,7 @@ var TechnologyService = class extends BaseService {
10618
10583
  * @returns Ažurirana tehnologija
10619
10584
  */
10620
10585
  async updateCertificationRequirement(technologyId, certificationRequirement) {
10621
- const docRef = doc25(this.getTechnologiesRef(), technologyId);
10586
+ const docRef = doc26(this.getTechnologiesRef(), technologyId);
10622
10587
  await updateDoc26(docRef, {
10623
10588
  certificationRequirement,
10624
10589
  updatedAt: /* @__PURE__ */ new Date()
@@ -10722,7 +10687,7 @@ var TechnologyService = class extends BaseService {
10722
10687
  import {
10723
10688
  addDoc as addDoc8,
10724
10689
  collection as collection25,
10725
- doc as doc26,
10690
+ doc as doc27,
10726
10691
  getDoc as getDoc29,
10727
10692
  getDocs as getDocs24,
10728
10693
  query as query24,
@@ -10777,9 +10742,9 @@ var ProductService = class extends BaseService {
10777
10742
  );
10778
10743
  const snapshot = await getDocs24(q);
10779
10744
  return snapshot.docs.map(
10780
- (doc27) => ({
10781
- id: doc27.id,
10782
- ...doc27.data()
10745
+ (doc28) => ({
10746
+ id: doc28.id,
10747
+ ...doc28.data()
10783
10748
  })
10784
10749
  );
10785
10750
  }
@@ -10799,9 +10764,9 @@ var ProductService = class extends BaseService {
10799
10764
  const snapshot = await getDocs24(q);
10800
10765
  products.push(
10801
10766
  ...snapshot.docs.map(
10802
- (doc27) => ({
10803
- id: doc27.id,
10804
- ...doc27.data()
10767
+ (doc28) => ({
10768
+ id: doc28.id,
10769
+ ...doc28.data()
10805
10770
  })
10806
10771
  )
10807
10772
  );
@@ -10816,7 +10781,7 @@ var ProductService = class extends BaseService {
10816
10781
  ...product,
10817
10782
  updatedAt: /* @__PURE__ */ new Date()
10818
10783
  };
10819
- const docRef = doc26(this.getProductsRef(technologyId), productId);
10784
+ const docRef = doc27(this.getProductsRef(technologyId), productId);
10820
10785
  await updateDoc27(docRef, updateData);
10821
10786
  return this.getById(technologyId, productId);
10822
10787
  }
@@ -10832,7 +10797,7 @@ var ProductService = class extends BaseService {
10832
10797
  * Gets a product by ID
10833
10798
  */
10834
10799
  async getById(technologyId, productId) {
10835
- const docRef = doc26(this.getProductsRef(technologyId), productId);
10800
+ const docRef = doc27(this.getProductsRef(technologyId), productId);
10836
10801
  const docSnap = await getDoc29(docRef);
10837
10802
  if (!docSnap.exists()) return null;
10838
10803
  return {
@@ -10959,6 +10924,7 @@ export {
10959
10924
  ProductService,
10960
10925
  REGISTER_TOKENS_COLLECTION,
10961
10926
  SYNCED_CALENDARS_COLLECTION,
10927
+ SearchLocationEnum,
10962
10928
  SubcategoryService,
10963
10929
  SubscriptionModel,
10964
10930
  SyncedCalendarProvider,