@blackcode_sa/metaestetics-api 1.12.5 → 1.12.7

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
@@ -1919,9 +1919,9 @@ import {
1919
1919
  confirmPasswordReset
1920
1920
  } from "firebase/auth";
1921
1921
  import {
1922
- collection as collection17,
1923
- query as query17,
1924
- getDocs as getDocs17,
1922
+ collection as collection18,
1923
+ query as query18,
1924
+ getDocs as getDocs18,
1925
1925
  runTransaction
1926
1926
  } from "firebase/firestore";
1927
1927
 
@@ -7826,14 +7826,154 @@ var UserService = class extends BaseService {
7826
7826
  }
7827
7827
  };
7828
7828
 
7829
- // src/services/clinic/utils/clinic-group.utils.ts
7829
+ // src/services/clinic/billing-transactions.service.ts
7830
7830
  import {
7831
7831
  collection as collection12,
7832
- doc as doc13,
7833
- getDoc as getDoc16,
7834
7832
  getDocs as getDocs12,
7835
7833
  query as query12,
7836
- where as where12,
7834
+ orderBy as orderBy5,
7835
+ limit as limit8,
7836
+ startAfter as startAfter7,
7837
+ where as where12
7838
+ } from "firebase/firestore";
7839
+ var BillingTransactionsService = class extends BaseService {
7840
+ constructor() {
7841
+ super(...arguments);
7842
+ this.BILLING_TRANSACTIONS_COLLECTION = "billingTransactions";
7843
+ }
7844
+ /**
7845
+ * Get billing transactions for a clinic group with pagination
7846
+ * @param clinicGroupId - The clinic group ID
7847
+ * @param options - Query options
7848
+ * @returns Promise with transactions and pagination info
7849
+ */
7850
+ async getBillingTransactions(clinicGroupId, options = {}) {
7851
+ try {
7852
+ const { limit: queryLimit = 50, startAfter: startAfterDoc, transactionType } = options;
7853
+ const constraints = [];
7854
+ if (transactionType) {
7855
+ constraints.push(where12("type", "==", transactionType));
7856
+ }
7857
+ constraints.push(orderBy5("timestamp", "desc"));
7858
+ if (startAfterDoc) {
7859
+ constraints.push(startAfter7(startAfterDoc));
7860
+ }
7861
+ constraints.push(limit8(queryLimit + 1));
7862
+ const transactionsRef = collection12(
7863
+ this.db,
7864
+ CLINIC_GROUPS_COLLECTION,
7865
+ clinicGroupId,
7866
+ this.BILLING_TRANSACTIONS_COLLECTION
7867
+ );
7868
+ const q = query12(transactionsRef, ...constraints);
7869
+ const querySnapshot = await getDocs12(q);
7870
+ const docs = querySnapshot.docs;
7871
+ const hasMore = docs.length > queryLimit;
7872
+ const transactions = docs.slice(0, queryLimit).map((doc38) => ({
7873
+ id: doc38.id,
7874
+ ...doc38.data()
7875
+ }));
7876
+ const lastDoc = transactions.length > 0 ? docs[transactions.length - 1] : null;
7877
+ return {
7878
+ transactions,
7879
+ lastDoc,
7880
+ hasMore
7881
+ };
7882
+ } catch (error) {
7883
+ console.error(
7884
+ `Error fetching billing transactions for clinic group ${clinicGroupId}:`,
7885
+ error
7886
+ );
7887
+ throw new Error(
7888
+ `Failed to fetch billing transactions: ${error instanceof Error ? error.message : "Unknown error"}`
7889
+ );
7890
+ }
7891
+ }
7892
+ /**
7893
+ * Get recent billing transactions (last 10)
7894
+ * @param clinicGroupId - The clinic group ID
7895
+ * @returns Promise with recent transactions
7896
+ */
7897
+ async getRecentBillingTransactions(clinicGroupId) {
7898
+ const result = await this.getBillingTransactions(clinicGroupId, { limit: 10 });
7899
+ return result.transactions;
7900
+ }
7901
+ /**
7902
+ * Get billing transactions by type
7903
+ * @param clinicGroupId - The clinic group ID
7904
+ * @param transactionType - The transaction type to filter by
7905
+ * @param options - Additional query options
7906
+ * @returns Promise with filtered transactions
7907
+ */
7908
+ async getBillingTransactionsByType(clinicGroupId, transactionType, options = {}) {
7909
+ return this.getBillingTransactions(clinicGroupId, {
7910
+ ...options,
7911
+ transactionType
7912
+ });
7913
+ }
7914
+ /**
7915
+ * Get subscription-related transactions only
7916
+ * @param clinicGroupId - The clinic group ID
7917
+ * @param options - Query options
7918
+ * @returns Promise with subscription transactions
7919
+ */
7920
+ async getSubscriptionTransactions(clinicGroupId, options = {}) {
7921
+ try {
7922
+ const { limit: queryLimit = 50, startAfter: startAfterDoc } = options;
7923
+ const subscriptionTypes = [
7924
+ "subscription_created" /* SUBSCRIPTION_CREATED */,
7925
+ "subscription_activated" /* SUBSCRIPTION_ACTIVATED */,
7926
+ "subscription_renewed" /* SUBSCRIPTION_RENEWED */,
7927
+ "subscription_updated" /* SUBSCRIPTION_UPDATED */,
7928
+ "subscription_canceled" /* SUBSCRIPTION_CANCELED */,
7929
+ "subscription_reactivated" /* SUBSCRIPTION_REACTIVATED */,
7930
+ "subscription_deleted" /* SUBSCRIPTION_DELETED */
7931
+ ];
7932
+ const constraints = [where12("type", "in", subscriptionTypes), orderBy5("timestamp", "desc")];
7933
+ if (startAfterDoc) {
7934
+ constraints.push(startAfter7(startAfterDoc));
7935
+ }
7936
+ constraints.push(limit8(queryLimit + 1));
7937
+ const transactionsRef = collection12(
7938
+ this.db,
7939
+ CLINIC_GROUPS_COLLECTION,
7940
+ clinicGroupId,
7941
+ this.BILLING_TRANSACTIONS_COLLECTION
7942
+ );
7943
+ const q = query12(transactionsRef, ...constraints);
7944
+ const querySnapshot = await getDocs12(q);
7945
+ const docs = querySnapshot.docs;
7946
+ const hasMore = docs.length > queryLimit;
7947
+ const transactions = docs.slice(0, queryLimit).map((doc38) => ({
7948
+ id: doc38.id,
7949
+ ...doc38.data()
7950
+ }));
7951
+ const lastDoc = transactions.length > 0 ? docs[transactions.length - 1] : null;
7952
+ return {
7953
+ transactions,
7954
+ lastDoc,
7955
+ hasMore
7956
+ };
7957
+ } catch (error) {
7958
+ console.error(
7959
+ `Error fetching subscription transactions for clinic group ${clinicGroupId}:`,
7960
+ error
7961
+ );
7962
+ throw new Error(
7963
+ `Failed to fetch subscription transactions: ${error instanceof Error ? error.message : "Unknown error"}`
7964
+ );
7965
+ }
7966
+ }
7967
+ };
7968
+
7969
+ // src/services/clinic/utils/clinic-group.utils.ts
7970
+ import {
7971
+ collection as collection13,
7972
+ doc as doc13,
7973
+ getDoc as getDoc16,
7974
+ getDocs as getDocs13,
7975
+ query as query13,
7976
+ where as where13,
7837
7977
  updateDoc as updateDoc13,
7838
7978
  setDoc as setDoc12,
7839
7979
  Timestamp as Timestamp16
@@ -7962,7 +8102,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
7962
8102
  }
7963
8103
  const now = Timestamp16.now();
7964
8104
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
7965
- const groupId = doc13(collection12(db, CLINIC_GROUPS_COLLECTION)).id;
8105
+ const groupId = doc13(collection13(db, CLINIC_GROUPS_COLLECTION)).id;
7966
8106
  console.log("[CLINIC_GROUP] Logo value:", {
7967
8107
  logoValue: validatedData.logo,
7968
8108
  logoType: validatedData.logo === null ? "null" : typeof validatedData.logo
@@ -8066,11 +8206,11 @@ async function getClinicGroup(db, groupId) {
8066
8206
  return null;
8067
8207
  }
8068
8208
  async function getAllActiveGroups(db) {
8069
- const q = query12(
8070
- collection12(db, CLINIC_GROUPS_COLLECTION),
8071
- where12("isActive", "==", true)
8209
+ const q = query13(
8210
+ collection13(db, CLINIC_GROUPS_COLLECTION),
8211
+ where13("isActive", "==", true)
8072
8212
  );
8073
- const querySnapshot = await getDocs12(q);
8213
+ const querySnapshot = await getDocs13(q);
8074
8214
  return querySnapshot.docs.map((doc38) => doc38.data());
8075
8215
  }
8076
8216
  async function updateClinicGroup(db, groupId, data, app) {
@@ -8286,6 +8426,7 @@ var ClinicGroupService = class extends BaseService {
8286
8426
  constructor(db, auth, app, clinicAdminService) {
8287
8427
  super(db, auth, app);
8288
8428
  this.clinicAdminService = clinicAdminService;
8429
+ this.billingTransactionsService = new BillingTransactionsService(db, auth, app);
8289
8430
  }
8290
8431
  /**
8291
8432
  * Kreira novu grupaciju klinika
@@ -8322,23 +8463,13 @@ var ClinicGroupService = class extends BaseService {
8322
8463
  * Dodaje admina u grupaciju
8323
8464
  */
8324
8465
  async addAdminToGroup(groupId, adminId) {
8325
- return addAdminToGroup(
8326
- this.db,
8327
- groupId,
8328
- adminId,
8329
- this.app
8330
- );
8466
+ return addAdminToGroup(this.db, groupId, adminId, this.app);
8331
8467
  }
8332
8468
  /**
8333
8469
  * Uklanja admina iz grupacije
8334
8470
  */
8335
8471
  async removeAdminFromGroup(groupId, adminId) {
8336
- return removeAdminFromGroup(
8337
- this.db,
8338
- groupId,
8339
- adminId,
8340
- this.app
8341
- );
8472
+ return removeAdminFromGroup(this.db, groupId, adminId, this.app);
8342
8473
  }
8343
8474
  /**
8344
8475
  * Deaktivira grupaciju klinika
@@ -8378,10 +8509,7 @@ var ClinicGroupService = class extends BaseService {
8378
8509
  logoUrl = uploadedLogoUrl;
8379
8510
  }
8380
8511
  } catch (error) {
8381
- console.error(
8382
- "[CLINIC_GROUP] Error processing logo in setupClinicGroup:",
8383
- error
8384
- );
8512
+ console.error("[CLINIC_GROUP] Error processing logo in setupClinicGroup:", error);
8385
8513
  }
8386
8514
  }
8387
8515
  const updateData = {
@@ -8400,48 +8528,25 @@ var ClinicGroupService = class extends BaseService {
8400
8528
  * Kreira admin token za grupaciju
8401
8529
  */
8402
8530
  async createAdminToken(groupId, creatorAdminId, data) {
8403
- return createAdminToken(
8404
- this.db,
8405
- groupId,
8406
- creatorAdminId,
8407
- this.app,
8408
- data
8409
- );
8531
+ return createAdminToken(this.db, groupId, creatorAdminId, this.app, data);
8410
8532
  }
8411
8533
  /**
8412
8534
  * Verifikuje i koristi admin token
8413
8535
  */
8414
8536
  async verifyAndUseAdminToken(groupId, token, userRef) {
8415
- return verifyAndUseAdminToken(
8416
- this.db,
8417
- groupId,
8418
- token,
8419
- userRef,
8420
- this.app
8421
- );
8537
+ return verifyAndUseAdminToken(this.db, groupId, token, userRef, this.app);
8422
8538
  }
8423
8539
  /**
8424
8540
  * Briše admin token
8425
8541
  */
8426
8542
  async deleteAdminToken(groupId, tokenId, adminId) {
8427
- return deleteAdminToken(
8428
- this.db,
8429
- groupId,
8430
- tokenId,
8431
- adminId,
8432
- this.app
8433
- );
8543
+ return deleteAdminToken(this.db, groupId, tokenId, adminId, this.app);
8434
8544
  }
8435
8545
  /**
8436
8546
  * Dohvata aktivne admin tokene
8437
8547
  */
8438
8548
  async getActiveAdminTokens(groupId, adminId) {
8439
- return getActiveAdminTokens(
8440
- this.db,
8441
- groupId,
8442
- adminId,
8443
- this.app
8444
- );
8549
+ return getActiveAdminTokens(this.db, groupId, adminId, this.app);
8445
8550
  }
8446
8551
  // TODO: Add a method to get all admin tokens for a clinic group (not just active ones)
8447
8552
  // TODO: Refactor admin token methods not to add tokens to the clinicGroup document,
@@ -8485,14 +8590,43 @@ var ClinicGroupService = class extends BaseService {
8485
8590
  console.log("[CLINIC_GROUP] Completing onboarding", { groupId });
8486
8591
  return this.setOnboarding(groupId, { completed: true });
8487
8592
  }
8593
+ /**
8594
+ * Get billing transactions for a clinic group
8595
+ *
8596
+ * @param groupId - The clinic group ID
8597
+ * @param options - Query options for pagination and filtering
8598
+ * @returns Promise with billing transactions and pagination info
8599
+ */
8600
+ async getBillingTransactions(groupId, options = {}) {
8601
+ return this.billingTransactionsService.getBillingTransactions(groupId, options);
8602
+ }
8603
+ /**
8604
+ * Get recent billing transactions for a clinic group (last 10)
8605
+ *
8606
+ * @param groupId - The clinic group ID
8607
+ * @returns Promise with recent billing transactions
8608
+ */
8609
+ async getRecentBillingTransactions(groupId) {
8610
+ return this.billingTransactionsService.getRecentBillingTransactions(groupId);
8611
+ }
8612
+ /**
8613
+ * Get subscription-related billing transactions for a clinic group
8614
+ *
8615
+ * @param groupId - The clinic group ID
8616
+ * @param options - Query options for pagination
8617
+ * @returns Promise with subscription transactions and pagination info
8618
+ */
8619
+ async getSubscriptionTransactions(groupId, options = {}) {
8620
+ return this.billingTransactionsService.getSubscriptionTransactions(groupId, options);
8621
+ }
8488
8622
  };
8489
8623
 
8490
8624
  // src/services/clinic/clinic.service.ts
8491
8625
  import {
8492
- collection as collection16,
8626
+ collection as collection17,
8493
8627
  doc as doc15,
8494
8628
  getDoc as getDoc18,
8495
- getDocs as getDocs16,
8629
+ getDocs as getDocs17,
8496
8630
  updateDoc as updateDoc15,
8497
8631
  serverTimestamp as serverTimestamp14,
8498
8632
  writeBatch as writeBatch4,
@@ -8506,17 +8640,17 @@ import { z as z20 } from "zod";
8506
8640
 
8507
8641
  // src/services/clinic/utils/clinic.utils.ts
8508
8642
  import {
8509
- collection as collection13,
8643
+ collection as collection14,
8510
8644
  doc as doc14,
8511
8645
  getDoc as getDoc17,
8512
- getDocs as getDocs13,
8513
- query as query13,
8514
- where as where13,
8646
+ getDocs as getDocs14,
8647
+ query as query14,
8648
+ where as where14,
8515
8649
  updateDoc as updateDoc14,
8516
8650
  setDoc as setDoc13,
8517
8651
  Timestamp as Timestamp17,
8518
- limit as limit8,
8519
- startAfter as startAfter7
8652
+ limit as limit9,
8653
+ startAfter as startAfter8
8520
8654
  } from "firebase/firestore";
8521
8655
  import {
8522
8656
  geohashForLocation as geohashForLocation3,
@@ -8533,12 +8667,12 @@ async function getClinic(db, clinicId) {
8533
8667
  return null;
8534
8668
  }
8535
8669
  async function getClinicsByGroup(db, groupId) {
8536
- const q = query13(
8537
- collection13(db, CLINICS_COLLECTION),
8538
- where13("clinicGroupId", "==", groupId),
8539
- where13("isActive", "==", true)
8670
+ const q = query14(
8671
+ collection14(db, CLINICS_COLLECTION),
8672
+ where14("clinicGroupId", "==", groupId),
8673
+ where14("isActive", "==", true)
8540
8674
  );
8541
- const querySnapshot = await getDocs13(q);
8675
+ const querySnapshot = await getDocs14(q);
8542
8676
  return querySnapshot.docs.map((doc38) => doc38.data());
8543
8677
  }
8544
8678
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
@@ -8727,12 +8861,12 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
8727
8861
  if (clinicIds.length === 0) {
8728
8862
  return [];
8729
8863
  }
8730
- const constraints = [where13("id", "in", clinicIds)];
8864
+ const constraints = [where14("id", "in", clinicIds)];
8731
8865
  if (options.isActive !== void 0) {
8732
- constraints.push(where13("isActive", "==", options.isActive));
8866
+ constraints.push(where14("isActive", "==", options.isActive));
8733
8867
  }
8734
- const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8735
- const querySnapshot = await getDocs13(q);
8868
+ const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8869
+ const querySnapshot = await getDocs14(q);
8736
8870
  return querySnapshot.docs.map((doc38) => doc38.data());
8737
8871
  }
8738
8872
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
@@ -8763,20 +8897,20 @@ async function getClinicById(db, clinicId) {
8763
8897
  }
8764
8898
  async function getAllClinics(db, pagination, lastDoc) {
8765
8899
  try {
8766
- const clinicsCollection = collection13(db, CLINICS_COLLECTION);
8767
- let clinicsQuery = query13(clinicsCollection);
8900
+ const clinicsCollection = collection14(db, CLINICS_COLLECTION);
8901
+ let clinicsQuery = query14(clinicsCollection);
8768
8902
  if (pagination && pagination > 0) {
8769
8903
  if (lastDoc) {
8770
- clinicsQuery = query13(
8904
+ clinicsQuery = query14(
8771
8905
  clinicsCollection,
8772
- startAfter7(lastDoc),
8773
- limit8(pagination)
8906
+ startAfter8(lastDoc),
8907
+ limit9(pagination)
8774
8908
  );
8775
8909
  } else {
8776
- clinicsQuery = query13(clinicsCollection, limit8(pagination));
8910
+ clinicsQuery = query14(clinicsCollection, limit9(pagination));
8777
8911
  }
8778
8912
  }
8779
- const clinicsSnapshot = await getDocs13(clinicsQuery);
8913
+ const clinicsSnapshot = await getDocs14(clinicsQuery);
8780
8914
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
8781
8915
  const clinics = clinicsSnapshot.docs.map((doc38) => {
8782
8916
  const data = doc38.data();
@@ -8803,12 +8937,12 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
8803
8937
  let lastDocSnapshot = null;
8804
8938
  for (const b of bounds) {
8805
8939
  const constraints = [
8806
- where13("location.geohash", ">=", b[0]),
8807
- where13("location.geohash", "<=", b[1]),
8808
- where13("isActive", "==", true)
8940
+ where14("location.geohash", ">=", b[0]),
8941
+ where14("location.geohash", "<=", b[1]),
8942
+ where14("isActive", "==", true)
8809
8943
  ];
8810
- const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8811
- const querySnapshot = await getDocs13(q);
8944
+ const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8945
+ const querySnapshot = await getDocs14(q);
8812
8946
  for (const doc38 of querySnapshot.docs) {
8813
8947
  const clinic = doc38.data();
8814
8948
  const distance = distanceBetween2(
@@ -8904,10 +9038,10 @@ async function removeTags(db, clinicId, adminId, tagsToRemove, clinicAdminServic
8904
9038
 
8905
9039
  // src/services/clinic/utils/search.utils.ts
8906
9040
  import {
8907
- collection as collection14,
8908
- query as query14,
8909
- where as where14,
8910
- getDocs as getDocs14
9041
+ collection as collection15,
9042
+ query as query15,
9043
+ where as where15,
9044
+ getDocs as getDocs15
8911
9045
  } from "firebase/firestore";
8912
9046
  import { geohashQueryBounds as geohashQueryBounds2, distanceBetween as distanceBetween3 } from "geofire-common";
8913
9047
  async function findClinicsInRadius(db, center, radiusInKm, filters) {
@@ -8918,20 +9052,20 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
8918
9052
  const matchingDocs = [];
8919
9053
  for (const b of bounds) {
8920
9054
  const constraints = [
8921
- where14("location.geohash", ">=", b[0]),
8922
- where14("location.geohash", "<=", b[1]),
8923
- where14("isActive", "==", true)
9055
+ where15("location.geohash", ">=", b[0]),
9056
+ where15("location.geohash", "<=", b[1]),
9057
+ where15("isActive", "==", true)
8924
9058
  ];
8925
9059
  if (filters == null ? void 0 : filters.services) {
8926
9060
  constraints.push(
8927
- where14("services", "array-contains-any", filters.services)
9061
+ where15("services", "array-contains-any", filters.services)
8928
9062
  );
8929
9063
  }
8930
9064
  if ((filters == null ? void 0 : filters.tags) && filters.tags.length > 0) {
8931
- constraints.push(where14("tags", "array-contains-any", filters.tags));
9065
+ constraints.push(where15("tags", "array-contains-any", filters.tags));
8932
9066
  }
8933
- const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8934
- const querySnapshot = await getDocs14(q);
9067
+ const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9068
+ const querySnapshot = await getDocs15(q);
8935
9069
  for (const doc38 of querySnapshot.docs) {
8936
9070
  const clinic = doc38.data();
8937
9071
  const distance = distanceBetween3(
@@ -8959,13 +9093,13 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
8959
9093
 
8960
9094
  // src/services/clinic/utils/filter.utils.ts
8961
9095
  import {
8962
- collection as collection15,
8963
- query as query15,
8964
- where as where15,
8965
- getDocs as getDocs15,
8966
- startAfter as startAfter8,
8967
- limit as limit9,
8968
- orderBy as orderBy5
9096
+ collection as collection16,
9097
+ query as query16,
9098
+ where as where16,
9099
+ getDocs as getDocs16,
9100
+ startAfter as startAfter9,
9101
+ limit as limit10,
9102
+ orderBy as orderBy6
8969
9103
  } from "firebase/firestore";
8970
9104
  import { geohashQueryBounds as geohashQueryBounds3, distanceBetween as distanceBetween4 } from "geofire-common";
8971
9105
  async function getClinicsByFilters(db, filters) {
@@ -8994,15 +9128,15 @@ async function getClinicsByFilters(db, filters) {
8994
9128
  const collected = [];
8995
9129
  for (const b of bounds) {
8996
9130
  const constraints = [
8997
- where15("location.geohash", ">=", b[0]),
8998
- where15("location.geohash", "<=", b[1]),
8999
- where15("isActive", "==", (_a = filters.isActive) != null ? _a : true)
9131
+ where16("location.geohash", ">=", b[0]),
9132
+ where16("location.geohash", "<=", b[1]),
9133
+ where16("isActive", "==", (_a = filters.isActive) != null ? _a : true)
9000
9134
  ];
9001
9135
  if (filters.tags && filters.tags.length > 0) {
9002
- constraints.push(where15("tags", "array-contains", filters.tags[0]));
9136
+ constraints.push(where16("tags", "array-contains", filters.tags[0]));
9003
9137
  }
9004
- const q0 = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9005
- const snap = await getDocs15(q0);
9138
+ const q0 = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9139
+ const snap = await getDocs16(q0);
9006
9140
  snap.docs.forEach((d) => collected.push({ ...d.data(), id: d.id }));
9007
9141
  }
9008
9142
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -9030,15 +9164,15 @@ async function getClinicsByFilters(db, filters) {
9030
9164
  const getBaseConstraints = () => {
9031
9165
  var _a2;
9032
9166
  const constraints = [];
9033
- constraints.push(where15("isActive", "==", (_a2 = filters.isActive) != null ? _a2 : true));
9167
+ constraints.push(where16("isActive", "==", (_a2 = filters.isActive) != null ? _a2 : true));
9034
9168
  if (filters.tags && filters.tags.length > 0) {
9035
- constraints.push(where15("tags", "array-contains", filters.tags[0]));
9169
+ constraints.push(where16("tags", "array-contains", filters.tags[0]));
9036
9170
  }
9037
9171
  if (filters.minRating !== void 0) {
9038
- constraints.push(where15("reviewInfo.averageRating", ">=", filters.minRating));
9172
+ constraints.push(where16("reviewInfo.averageRating", ">=", filters.minRating));
9039
9173
  }
9040
9174
  if (filters.maxRating !== void 0) {
9041
- constraints.push(where15("reviewInfo.averageRating", "<=", filters.maxRating));
9175
+ constraints.push(where16("reviewInfo.averageRating", "<=", filters.maxRating));
9042
9176
  }
9043
9177
  return constraints;
9044
9178
  };
@@ -9047,21 +9181,21 @@ async function getClinicsByFilters(db, filters) {
9047
9181
  console.log("[CLINIC_SERVICE] Strategy 1: Trying nameLower search");
9048
9182
  const searchTerm = filters.nameSearch.trim().toLowerCase();
9049
9183
  const constraints = getBaseConstraints();
9050
- constraints.push(where15("nameLower", ">=", searchTerm));
9051
- constraints.push(where15("nameLower", "<=", searchTerm + "\uF8FF"));
9052
- constraints.push(orderBy5("nameLower"));
9184
+ constraints.push(where16("nameLower", ">=", searchTerm));
9185
+ constraints.push(where16("nameLower", "<=", searchTerm + "\uF8FF"));
9186
+ constraints.push(orderBy6("nameLower"));
9053
9187
  if (filters.lastDoc) {
9054
9188
  if (typeof filters.lastDoc.data === "function") {
9055
- constraints.push(startAfter8(filters.lastDoc));
9189
+ constraints.push(startAfter9(filters.lastDoc));
9056
9190
  } else if (Array.isArray(filters.lastDoc)) {
9057
- constraints.push(startAfter8(...filters.lastDoc));
9191
+ constraints.push(startAfter9(...filters.lastDoc));
9058
9192
  } else {
9059
- constraints.push(startAfter8(filters.lastDoc));
9193
+ constraints.push(startAfter9(filters.lastDoc));
9060
9194
  }
9061
9195
  }
9062
- constraints.push(limit9(filters.pagination || 5));
9063
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9064
- const querySnapshot = await getDocs15(q);
9196
+ constraints.push(limit10(filters.pagination || 5));
9197
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9198
+ const querySnapshot = await getDocs16(q);
9065
9199
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9066
9200
  clinics = applyInMemoryFilters(clinics, filters);
9067
9201
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9079,21 +9213,21 @@ async function getClinicsByFilters(db, filters) {
9079
9213
  console.log("[CLINIC_SERVICE] Strategy 2: Trying name field search");
9080
9214
  const searchTerm = filters.nameSearch.trim().toLowerCase();
9081
9215
  const constraints = getBaseConstraints();
9082
- constraints.push(where15("name", ">=", searchTerm));
9083
- constraints.push(where15("name", "<=", searchTerm + "\uF8FF"));
9084
- constraints.push(orderBy5("name"));
9216
+ constraints.push(where16("name", ">=", searchTerm));
9217
+ constraints.push(where16("name", "<=", searchTerm + "\uF8FF"));
9218
+ constraints.push(orderBy6("name"));
9085
9219
  if (filters.lastDoc) {
9086
9220
  if (typeof filters.lastDoc.data === "function") {
9087
- constraints.push(startAfter8(filters.lastDoc));
9221
+ constraints.push(startAfter9(filters.lastDoc));
9088
9222
  } else if (Array.isArray(filters.lastDoc)) {
9089
- constraints.push(startAfter8(...filters.lastDoc));
9223
+ constraints.push(startAfter9(...filters.lastDoc));
9090
9224
  } else {
9091
- constraints.push(startAfter8(filters.lastDoc));
9225
+ constraints.push(startAfter9(filters.lastDoc));
9092
9226
  }
9093
9227
  }
9094
- constraints.push(limit9(filters.pagination || 5));
9095
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9096
- const querySnapshot = await getDocs15(q);
9228
+ constraints.push(limit10(filters.pagination || 5));
9229
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9230
+ const querySnapshot = await getDocs16(q);
9097
9231
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9098
9232
  clinics = applyInMemoryFilters(clinics, filters);
9099
9233
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9111,19 +9245,19 @@ async function getClinicsByFilters(db, filters) {
9111
9245
  "[CLINIC_SERVICE] Strategy 3: Using createdAt ordering with client-side filtering"
9112
9246
  );
9113
9247
  const constraints = getBaseConstraints();
9114
- constraints.push(orderBy5("createdAt", "desc"));
9248
+ constraints.push(orderBy6("createdAt", "desc"));
9115
9249
  if (filters.lastDoc) {
9116
9250
  if (typeof filters.lastDoc.data === "function") {
9117
- constraints.push(startAfter8(filters.lastDoc));
9251
+ constraints.push(startAfter9(filters.lastDoc));
9118
9252
  } else if (Array.isArray(filters.lastDoc)) {
9119
- constraints.push(startAfter8(...filters.lastDoc));
9253
+ constraints.push(startAfter9(...filters.lastDoc));
9120
9254
  } else {
9121
- constraints.push(startAfter8(filters.lastDoc));
9255
+ constraints.push(startAfter9(filters.lastDoc));
9122
9256
  }
9123
9257
  }
9124
- constraints.push(limit9(filters.pagination || 5));
9125
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9126
- const querySnapshot = await getDocs15(q);
9258
+ constraints.push(limit10(filters.pagination || 5));
9259
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9260
+ const querySnapshot = await getDocs16(q);
9127
9261
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9128
9262
  clinics = applyInMemoryFilters(clinics, filters);
9129
9263
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9138,12 +9272,12 @@ async function getClinicsByFilters(db, filters) {
9138
9272
  try {
9139
9273
  console.log("[CLINIC_SERVICE] Strategy 4: Minimal fallback");
9140
9274
  const constraints = [
9141
- where15("isActive", "==", true),
9142
- orderBy5("createdAt", "desc"),
9143
- limit9(filters.pagination || 5)
9275
+ where16("isActive", "==", true),
9276
+ orderBy6("createdAt", "desc"),
9277
+ limit10(filters.pagination || 5)
9144
9278
  ];
9145
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9146
- const querySnapshot = await getDocs15(q);
9279
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9280
+ const querySnapshot = await getDocs16(q);
9147
9281
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9148
9282
  clinics = applyInMemoryFilters(clinics, filters);
9149
9283
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9718,8 +9852,8 @@ var ClinicService = class extends BaseService {
9718
9852
  * @returns Array of minimal clinic info for map
9719
9853
  */
9720
9854
  async getClinicsForMap() {
9721
- const clinicsRef = collection16(this.db, CLINICS_COLLECTION);
9722
- const snapshot = await getDocs16(clinicsRef);
9855
+ const clinicsRef = collection17(this.db, CLINICS_COLLECTION);
9856
+ const snapshot = await getDocs17(clinicsRef);
9723
9857
  const clinicsForMap = snapshot.docs.map((doc38) => {
9724
9858
  var _a, _b, _c;
9725
9859
  const data = doc38.data();
@@ -10068,9 +10202,9 @@ var AuthService = class extends BaseService {
10068
10202
  token: data.inviteToken
10069
10203
  });
10070
10204
  console.log("[AUTH] Searching for token in clinic groups");
10071
- const groupsRef = collection17(this.db, CLINIC_GROUPS_COLLECTION);
10072
- const q = query17(groupsRef);
10073
- const querySnapshot = await getDocs17(q);
10205
+ const groupsRef = collection18(this.db, CLINIC_GROUPS_COLLECTION);
10206
+ const q = query18(groupsRef);
10207
+ const querySnapshot = await getDocs18(q);
10074
10208
  let foundGroup = null;
10075
10209
  let foundToken = null;
10076
10210
  console.log(
@@ -10721,26 +10855,26 @@ import { Timestamp as Timestamp26, serverTimestamp as serverTimestamp20 } from "
10721
10855
  import {
10722
10856
  doc as doc23,
10723
10857
  getDoc as getDoc25,
10724
- collection as collection23,
10725
- query as query23,
10726
- where as where23,
10727
- getDocs as getDocs23,
10858
+ collection as collection24,
10859
+ query as query24,
10860
+ where as where24,
10861
+ getDocs as getDocs24,
10728
10862
  setDoc as setDoc21,
10729
10863
  updateDoc as updateDoc22
10730
10864
  } from "firebase/firestore";
10731
10865
 
10732
10866
  // src/services/calendar/utils/clinic.utils.ts
10733
10867
  import {
10734
- collection as collection18,
10868
+ collection as collection19,
10735
10869
  doc as doc18,
10736
10870
  getDoc as getDoc20,
10737
- getDocs as getDocs18,
10871
+ getDocs as getDocs19,
10738
10872
  setDoc as setDoc16,
10739
10873
  updateDoc as updateDoc17,
10740
10874
  deleteDoc as deleteDoc9,
10741
- query as query18,
10742
- where as where18,
10743
- orderBy as orderBy7,
10875
+ query as query19,
10876
+ where as where19,
10877
+ orderBy as orderBy8,
10744
10878
  Timestamp as Timestamp20,
10745
10879
  serverTimestamp as serverTimestamp15
10746
10880
  } from "firebase/firestore";
@@ -10836,15 +10970,15 @@ async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
10836
10970
 
10837
10971
  // src/services/calendar/utils/patient.utils.ts
10838
10972
  import {
10839
- collection as collection19,
10973
+ collection as collection20,
10840
10974
  getDoc as getDoc21,
10841
- getDocs as getDocs19,
10975
+ getDocs as getDocs20,
10842
10976
  setDoc as setDoc17,
10843
10977
  updateDoc as updateDoc18,
10844
10978
  deleteDoc as deleteDoc10,
10845
- query as query19,
10846
- where as where19,
10847
- orderBy as orderBy8,
10979
+ query as query20,
10980
+ where as where20,
10981
+ orderBy as orderBy9,
10848
10982
  Timestamp as Timestamp21,
10849
10983
  serverTimestamp as serverTimestamp16
10850
10984
  } from "firebase/firestore";
@@ -10880,15 +11014,15 @@ async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData
10880
11014
 
10881
11015
  // src/services/calendar/utils/practitioner.utils.ts
10882
11016
  import {
10883
- collection as collection20,
11017
+ collection as collection21,
10884
11018
  getDoc as getDoc22,
10885
- getDocs as getDocs20,
11019
+ getDocs as getDocs21,
10886
11020
  setDoc as setDoc18,
10887
11021
  updateDoc as updateDoc19,
10888
11022
  deleteDoc as deleteDoc11,
10889
- query as query20,
10890
- where as where20,
10891
- orderBy as orderBy9,
11023
+ query as query21,
11024
+ where as where21,
11025
+ orderBy as orderBy10,
10892
11026
  Timestamp as Timestamp22,
10893
11027
  serverTimestamp as serverTimestamp17
10894
11028
  } from "firebase/firestore";
@@ -10982,16 +11116,16 @@ async function updateAppointmentUtil2(db, clinicId, practitionerId, patientId, e
10982
11116
 
10983
11117
  // src/services/calendar/utils/calendar-event.utils.ts
10984
11118
  import {
10985
- collection as collection21,
11119
+ collection as collection22,
10986
11120
  doc as doc21,
10987
11121
  getDoc as getDoc23,
10988
- getDocs as getDocs21,
11122
+ getDocs as getDocs22,
10989
11123
  setDoc as setDoc19,
10990
11124
  updateDoc as updateDoc20,
10991
11125
  deleteDoc as deleteDoc12,
10992
- query as query21,
10993
- where as where21,
10994
- orderBy as orderBy10,
11126
+ query as query22,
11127
+ where as where22,
11128
+ orderBy as orderBy11,
10995
11129
  Timestamp as Timestamp23,
10996
11130
  serverTimestamp as serverTimestamp18
10997
11131
  } from "firebase/firestore";
@@ -11037,7 +11171,7 @@ async function searchCalendarEventsUtil(db, params) {
11037
11171
  );
11038
11172
  }
11039
11173
  baseCollectionPath = `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
11040
- constraints.push(where21("clinicBranchId", "==", entityId));
11174
+ constraints.push(where22("clinicBranchId", "==", entityId));
11041
11175
  if (filters.clinicId && filters.clinicId !== entityId) {
11042
11176
  console.warn(
11043
11177
  `Provided clinicId filter (${filters.clinicId}) does not match search entityId (${entityId}). Returning empty results.`
@@ -11049,34 +11183,34 @@ async function searchCalendarEventsUtil(db, params) {
11049
11183
  default:
11050
11184
  throw new Error(`Invalid search location: ${searchLocation}`);
11051
11185
  }
11052
- const collectionRef = collection21(db, baseCollectionPath);
11186
+ const collectionRef = collection22(db, baseCollectionPath);
11053
11187
  if (filters.clinicId) {
11054
- constraints.push(where21("clinicBranchId", "==", filters.clinicId));
11188
+ constraints.push(where22("clinicBranchId", "==", filters.clinicId));
11055
11189
  }
11056
11190
  if (filters.practitionerId) {
11057
11191
  constraints.push(
11058
- where21("practitionerProfileId", "==", filters.practitionerId)
11192
+ where22("practitionerProfileId", "==", filters.practitionerId)
11059
11193
  );
11060
11194
  }
11061
11195
  if (filters.patientId) {
11062
- constraints.push(where21("patientProfileId", "==", filters.patientId));
11196
+ constraints.push(where22("patientProfileId", "==", filters.patientId));
11063
11197
  }
11064
11198
  if (filters.procedureId) {
11065
- constraints.push(where21("procedureId", "==", filters.procedureId));
11199
+ constraints.push(where22("procedureId", "==", filters.procedureId));
11066
11200
  }
11067
11201
  if (filters.eventStatus) {
11068
- constraints.push(where21("status", "==", filters.eventStatus));
11202
+ constraints.push(where22("status", "==", filters.eventStatus));
11069
11203
  }
11070
11204
  if (filters.eventType) {
11071
- constraints.push(where21("eventType", "==", filters.eventType));
11205
+ constraints.push(where22("eventType", "==", filters.eventType));
11072
11206
  }
11073
11207
  if (filters.dateRange) {
11074
- constraints.push(where21("eventTime.start", ">=", filters.dateRange.start));
11075
- constraints.push(where21("eventTime.start", "<=", filters.dateRange.end));
11208
+ constraints.push(where22("eventTime.start", ">=", filters.dateRange.start));
11209
+ constraints.push(where22("eventTime.start", "<=", filters.dateRange.end));
11076
11210
  }
11077
11211
  try {
11078
- const finalQuery = query21(collectionRef, ...constraints);
11079
- const querySnapshot = await getDocs21(finalQuery);
11212
+ const finalQuery = query22(collectionRef, ...constraints);
11213
+ const querySnapshot = await getDocs22(finalQuery);
11080
11214
  const events = querySnapshot.docs.map(
11081
11215
  (doc38) => ({ id: doc38.id, ...doc38.data() })
11082
11216
  );
@@ -11089,14 +11223,14 @@ async function searchCalendarEventsUtil(db, params) {
11089
11223
 
11090
11224
  // src/services/calendar/utils/synced-calendar.utils.ts
11091
11225
  import {
11092
- collection as collection22,
11226
+ collection as collection23,
11093
11227
  getDoc as getDoc24,
11094
- getDocs as getDocs22,
11228
+ getDocs as getDocs23,
11095
11229
  setDoc as setDoc20,
11096
11230
  updateDoc as updateDoc21,
11097
11231
  deleteDoc as deleteDoc13,
11098
- query as query22,
11099
- orderBy as orderBy11,
11232
+ query as query23,
11233
+ orderBy as orderBy12,
11100
11234
  Timestamp as Timestamp24,
11101
11235
  serverTimestamp as serverTimestamp19
11102
11236
  } from "firebase/firestore";
@@ -11165,12 +11299,12 @@ async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId)
11165
11299
  return calendarDoc.data();
11166
11300
  }
11167
11301
  async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
11168
- const calendarsRef = collection22(
11302
+ const calendarsRef = collection23(
11169
11303
  db,
11170
11304
  `practitioners/${practitionerId}/${SYNCED_CALENDARS_COLLECTION}`
11171
11305
  );
11172
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11173
- const querySnapshot = await getDocs22(q);
11306
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11307
+ const querySnapshot = await getDocs23(q);
11174
11308
  return querySnapshot.docs.map((doc38) => doc38.data());
11175
11309
  }
11176
11310
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
@@ -11182,12 +11316,12 @@ async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
11182
11316
  return calendarDoc.data();
11183
11317
  }
11184
11318
  async function getPatientSyncedCalendarsUtil(db, patientId) {
11185
- const calendarsRef = collection22(
11319
+ const calendarsRef = collection23(
11186
11320
  db,
11187
11321
  `patients/${patientId}/${SYNCED_CALENDARS_COLLECTION}`
11188
11322
  );
11189
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11190
- const querySnapshot = await getDocs22(q);
11323
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11324
+ const querySnapshot = await getDocs23(q);
11191
11325
  return querySnapshot.docs.map((doc38) => doc38.data());
11192
11326
  }
11193
11327
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
@@ -11199,12 +11333,12 @@ async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
11199
11333
  return calendarDoc.data();
11200
11334
  }
11201
11335
  async function getClinicSyncedCalendarsUtil(db, clinicId) {
11202
- const calendarsRef = collection22(
11336
+ const calendarsRef = collection23(
11203
11337
  db,
11204
11338
  `clinics/${clinicId}/${SYNCED_CALENDARS_COLLECTION}`
11205
11339
  );
11206
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11207
- const querySnapshot = await getDocs22(q);
11340
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11341
+ const querySnapshot = await getDocs23(q);
11208
11342
  return querySnapshot.docs.map((doc38) => doc38.data());
11209
11343
  }
11210
11344
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
@@ -12488,8 +12622,8 @@ var CalendarServiceV2 = class extends BaseService {
12488
12622
  */
12489
12623
  async synchronizeExternalCalendars(lookbackDays = 7, lookforwardDays = 30) {
12490
12624
  try {
12491
- const practitionersRef = collection23(this.db, PRACTITIONERS_COLLECTION);
12492
- const practitionersSnapshot = await getDocs23(practitionersRef);
12625
+ const practitionersRef = collection24(this.db, PRACTITIONERS_COLLECTION);
12626
+ const practitionersSnapshot = await getDocs24(practitionersRef);
12493
12627
  const startDate = /* @__PURE__ */ new Date();
12494
12628
  startDate.setDate(startDate.getDate() - lookbackDays);
12495
12629
  const endDate = /* @__PURE__ */ new Date();
@@ -12547,19 +12681,19 @@ var CalendarServiceV2 = class extends BaseService {
12547
12681
  async updateExistingEventsFromExternalCalendars(doctorId, startDate, endDate) {
12548
12682
  var _a;
12549
12683
  try {
12550
- const eventsRef = collection23(
12684
+ const eventsRef = collection24(
12551
12685
  this.db,
12552
12686
  PRACTITIONERS_COLLECTION,
12553
12687
  doctorId,
12554
12688
  CALENDAR_COLLECTION
12555
12689
  );
12556
- const q = query23(
12690
+ const q = query24(
12557
12691
  eventsRef,
12558
- where23("syncStatus", "==", "external" /* EXTERNAL */),
12559
- where23("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
12560
- where23("eventTime.start", "<=", Timestamp26.fromDate(endDate))
12692
+ where24("syncStatus", "==", "external" /* EXTERNAL */),
12693
+ where24("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
12694
+ where24("eventTime.start", "<=", Timestamp26.fromDate(endDate))
12561
12695
  );
12562
- const eventsSnapshot = await getDocs23(q);
12696
+ const eventsSnapshot = await getDocs24(q);
12563
12697
  const events = eventsSnapshot.docs.map((doc38) => ({
12564
12698
  id: doc38.id,
12565
12699
  ...doc38.data()
@@ -13184,18 +13318,18 @@ var CalendarServiceV2 = class extends BaseService {
13184
13318
  startOfDay.setHours(0, 0, 0, 0);
13185
13319
  const endOfDay = new Date(date);
13186
13320
  endOfDay.setHours(23, 59, 59, 999);
13187
- const appointmentsRef = collection23(this.db, CALENDAR_COLLECTION);
13188
- const q = query23(
13321
+ const appointmentsRef = collection24(this.db, CALENDAR_COLLECTION);
13322
+ const q = query24(
13189
13323
  appointmentsRef,
13190
- where23("practitionerProfileId", "==", doctorId),
13191
- where23("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
13192
- where23("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
13193
- where23("status", "in", [
13324
+ where24("practitionerProfileId", "==", doctorId),
13325
+ where24("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
13326
+ where24("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
13327
+ where24("status", "in", [
13194
13328
  "confirmed" /* CONFIRMED */,
13195
13329
  "pending" /* PENDING */
13196
13330
  ])
13197
13331
  );
13198
- const querySnapshot = await getDocs23(q);
13332
+ const querySnapshot = await getDocs24(q);
13199
13333
  return querySnapshot.docs.map((doc38) => doc38.data());
13200
13334
  }
13201
13335
  /**
@@ -13624,19 +13758,19 @@ var ExternalCalendarService = class extends BaseService {
13624
13758
 
13625
13759
  // src/services/clinic/practitioner-invite.service.ts
13626
13760
  import {
13627
- collection as collection24,
13761
+ collection as collection25,
13628
13762
  doc as doc25,
13629
13763
  getDoc as getDoc27,
13630
- getDocs as getDocs24,
13631
- query as query24,
13632
- where as where24,
13764
+ getDocs as getDocs25,
13765
+ query as query25,
13766
+ where as where25,
13633
13767
  updateDoc as updateDoc24,
13634
13768
  setDoc as setDoc23,
13635
13769
  deleteDoc as deleteDoc15,
13636
13770
  Timestamp as Timestamp28,
13637
13771
  serverTimestamp as serverTimestamp22,
13638
- orderBy as orderBy12,
13639
- limit as limit11
13772
+ orderBy as orderBy13,
13773
+ limit as limit12
13640
13774
  } from "firebase/firestore";
13641
13775
  var PractitionerInviteService = class extends BaseService {
13642
13776
  constructor(db, auth, app) {
@@ -13730,17 +13864,17 @@ var PractitionerInviteService = class extends BaseService {
13730
13864
  async getAllInvitesDoctor(practitionerId, statusFilter) {
13731
13865
  try {
13732
13866
  const constraints = [
13733
- where24("practitionerId", "==", practitionerId),
13734
- orderBy12("createdAt", "desc")
13867
+ where25("practitionerId", "==", practitionerId),
13868
+ orderBy13("createdAt", "desc")
13735
13869
  ];
13736
13870
  if (statusFilter && statusFilter.length > 0) {
13737
- constraints.push(where24("status", "in", statusFilter));
13871
+ constraints.push(where25("status", "in", statusFilter));
13738
13872
  }
13739
- const q = query24(
13740
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
13873
+ const q = query25(
13874
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13741
13875
  ...constraints
13742
13876
  );
13743
- const querySnapshot = await getDocs24(q);
13877
+ const querySnapshot = await getDocs25(q);
13744
13878
  return querySnapshot.docs.map((doc38) => doc38.data());
13745
13879
  } catch (error) {
13746
13880
  console.error(
@@ -13759,17 +13893,17 @@ var PractitionerInviteService = class extends BaseService {
13759
13893
  async getAllInvitesClinic(clinicId, statusFilter) {
13760
13894
  try {
13761
13895
  const constraints = [
13762
- where24("clinicId", "==", clinicId),
13763
- orderBy12("createdAt", "desc")
13896
+ where25("clinicId", "==", clinicId),
13897
+ orderBy13("createdAt", "desc")
13764
13898
  ];
13765
13899
  if (statusFilter && statusFilter.length > 0) {
13766
- constraints.push(where24("status", "in", statusFilter));
13900
+ constraints.push(where25("status", "in", statusFilter));
13767
13901
  }
13768
- const q = query24(
13769
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
13902
+ const q = query25(
13903
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13770
13904
  ...constraints
13771
13905
  );
13772
- const querySnapshot = await getDocs24(q);
13906
+ const querySnapshot = await getDocs25(q);
13773
13907
  return querySnapshot.docs.map((doc38) => doc38.data());
13774
13908
  } catch (error) {
13775
13909
  console.error(
@@ -13903,28 +14037,28 @@ var PractitionerInviteService = class extends BaseService {
13903
14037
  try {
13904
14038
  const constraints = [];
13905
14039
  if (filters.practitionerId) {
13906
- constraints.push(where24("practitionerId", "==", filters.practitionerId));
14040
+ constraints.push(where25("practitionerId", "==", filters.practitionerId));
13907
14041
  }
13908
14042
  if (filters.clinicId) {
13909
- constraints.push(where24("clinicId", "==", filters.clinicId));
14043
+ constraints.push(where25("clinicId", "==", filters.clinicId));
13910
14044
  }
13911
14045
  if (filters.invitedBy) {
13912
- constraints.push(where24("invitedBy", "==", filters.invitedBy));
14046
+ constraints.push(where25("invitedBy", "==", filters.invitedBy));
13913
14047
  }
13914
14048
  if (filters.status && filters.status.length > 0) {
13915
- constraints.push(where24("status", "in", filters.status));
14049
+ constraints.push(where25("status", "in", filters.status));
13916
14050
  }
13917
14051
  const orderField = filters.orderBy || "createdAt";
13918
14052
  const orderDirection = filters.orderDirection || "desc";
13919
- constraints.push(orderBy12(orderField, orderDirection));
14053
+ constraints.push(orderBy13(orderField, orderDirection));
13920
14054
  if (filters.limit) {
13921
- constraints.push(limit11(filters.limit));
14055
+ constraints.push(limit12(filters.limit));
13922
14056
  }
13923
- const q = query24(
13924
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
14057
+ const q = query25(
14058
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13925
14059
  ...constraints
13926
14060
  );
13927
- const querySnapshot = await getDocs24(q);
14061
+ const querySnapshot = await getDocs25(q);
13928
14062
  let invites = querySnapshot.docs.map(
13929
14063
  (doc38) => doc38.data()
13930
14064
  );
@@ -14005,14 +14139,14 @@ var PractitionerInviteService = class extends BaseService {
14005
14139
  */
14006
14140
  async findExistingInvite(practitionerId, clinicId) {
14007
14141
  try {
14008
- const q = query24(
14009
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
14010
- where24("practitionerId", "==", practitionerId),
14011
- where24("clinicId", "==", clinicId),
14012
- orderBy12("createdAt", "desc"),
14013
- limit11(1)
14014
- );
14015
- const querySnapshot = await getDocs24(q);
14142
+ const q = query25(
14143
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
14144
+ where25("practitionerId", "==", practitionerId),
14145
+ where25("clinicId", "==", clinicId),
14146
+ orderBy13("createdAt", "desc"),
14147
+ limit12(1)
14148
+ );
14149
+ const querySnapshot = await getDocs25(q);
14016
14150
  if (querySnapshot.empty) {
14017
14151
  return null;
14018
14152
  }
@@ -14029,24 +14163,24 @@ var PractitionerInviteService = class extends BaseService {
14029
14163
 
14030
14164
  // src/services/documentation-templates/documentation-template.service.ts
14031
14165
  import {
14032
- collection as collection25,
14166
+ collection as collection26,
14033
14167
  doc as doc26,
14034
14168
  getDoc as getDoc28,
14035
- getDocs as getDocs25,
14169
+ getDocs as getDocs26,
14036
14170
  setDoc as setDoc24,
14037
14171
  updateDoc as updateDoc25,
14038
14172
  deleteDoc as deleteDoc16,
14039
- query as query25,
14040
- where as where25,
14041
- orderBy as orderBy13,
14042
- limit as limit12,
14043
- startAfter as startAfter10
14173
+ query as query26,
14174
+ where as where26,
14175
+ orderBy as orderBy14,
14176
+ limit as limit13,
14177
+ startAfter as startAfter11
14044
14178
  } from "firebase/firestore";
14045
14179
  import { getCountFromServer } from "firebase/firestore";
14046
14180
  var DocumentationTemplateService = class extends BaseService {
14047
14181
  constructor(...args) {
14048
14182
  super(...args);
14049
- this.collectionRef = collection25(
14183
+ this.collectionRef = collection26(
14050
14184
  this.db,
14051
14185
  DOCUMENTATION_TEMPLATES_COLLECTION
14052
14186
  );
@@ -14130,7 +14264,7 @@ var DocumentationTemplateService = class extends BaseService {
14130
14264
  if (!template) {
14131
14265
  throw new Error(`Template with ID ${templateId} not found`);
14132
14266
  }
14133
- const versionsCollectionRef = collection25(
14267
+ const versionsCollectionRef = collection26(
14134
14268
  this.db,
14135
14269
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
14136
14270
  );
@@ -14190,12 +14324,12 @@ var DocumentationTemplateService = class extends BaseService {
14190
14324
  * @returns Array of template versions
14191
14325
  */
14192
14326
  async getTemplateOldVersions(templateId) {
14193
- const versionsCollectionRef = collection25(
14327
+ const versionsCollectionRef = collection26(
14194
14328
  this.db,
14195
14329
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
14196
14330
  );
14197
- const q = query25(versionsCollectionRef, orderBy13("version", "desc"));
14198
- const querySnapshot = await getDocs25(q);
14331
+ const q = query26(versionsCollectionRef, orderBy14("version", "desc"));
14332
+ const querySnapshot = await getDocs26(q);
14199
14333
  const versions = [];
14200
14334
  querySnapshot.forEach((doc38) => {
14201
14335
  versions.push(doc38.data());
@@ -14217,16 +14351,16 @@ var DocumentationTemplateService = class extends BaseService {
14217
14351
  * @returns Array of templates and the last document for pagination
14218
14352
  */
14219
14353
  async getActiveTemplates(pageSize = 20, lastDoc) {
14220
- let q = query25(
14354
+ let q = query26(
14221
14355
  this.collectionRef,
14222
- where25("isActive", "==", true),
14223
- orderBy13("updatedAt", "desc"),
14224
- limit12(pageSize)
14356
+ where26("isActive", "==", true),
14357
+ orderBy14("updatedAt", "desc"),
14358
+ limit13(pageSize)
14225
14359
  );
14226
14360
  if (lastDoc) {
14227
- q = query25(q, startAfter10(lastDoc));
14361
+ q = query26(q, startAfter11(lastDoc));
14228
14362
  }
14229
- const querySnapshot = await getDocs25(q);
14363
+ const querySnapshot = await getDocs26(q);
14230
14364
  const templates = [];
14231
14365
  let lastVisible = null;
14232
14366
  querySnapshot.forEach((doc38) => {
@@ -14252,25 +14386,25 @@ var DocumentationTemplateService = class extends BaseService {
14252
14386
  sortingOrder
14253
14387
  } = options;
14254
14388
  const constraints = [
14255
- where25("isActive", "==", true),
14256
- orderBy13("sortingOrder", "asc"),
14257
- orderBy13("title", "asc"),
14258
- limit12(pageSize)
14389
+ where26("isActive", "==", true),
14390
+ orderBy14("sortingOrder", "asc"),
14391
+ orderBy14("title", "asc"),
14392
+ limit13(pageSize)
14259
14393
  ];
14260
14394
  if (isUserForm !== void 0) {
14261
- constraints.push(where25("isUserForm", "==", isUserForm));
14395
+ constraints.push(where26("isUserForm", "==", isUserForm));
14262
14396
  }
14263
14397
  if (isRequired !== void 0) {
14264
- constraints.push(where25("isRequired", "==", isRequired));
14398
+ constraints.push(where26("isRequired", "==", isRequired));
14265
14399
  }
14266
14400
  if (sortingOrder !== void 0) {
14267
- constraints.push(where25("sortingOrder", "==", sortingOrder));
14401
+ constraints.push(where26("sortingOrder", "==", sortingOrder));
14268
14402
  }
14269
14403
  if (lastDoc) {
14270
- constraints.push(startAfter10(lastDoc));
14404
+ constraints.push(startAfter11(lastDoc));
14271
14405
  }
14272
- const q = query25(this.collectionRef, ...constraints.filter((c) => c));
14273
- const querySnapshot = await getDocs25(q);
14406
+ const q = query26(this.collectionRef, ...constraints.filter((c) => c));
14407
+ const querySnapshot = await getDocs26(q);
14274
14408
  const templates = [];
14275
14409
  let lastVisible = null;
14276
14410
  querySnapshot.forEach((doc38) => {
@@ -14289,17 +14423,17 @@ var DocumentationTemplateService = class extends BaseService {
14289
14423
  */
14290
14424
  async getTemplatesCount(options) {
14291
14425
  const { isUserForm, isRequired, sortingOrder } = options;
14292
- const constraints = [where25("isActive", "==", true)];
14426
+ const constraints = [where26("isActive", "==", true)];
14293
14427
  if (isUserForm !== void 0) {
14294
- constraints.push(where25("isUserForm", "==", isUserForm));
14428
+ constraints.push(where26("isUserForm", "==", isUserForm));
14295
14429
  }
14296
14430
  if (isRequired !== void 0) {
14297
- constraints.push(where25("isRequired", "==", isRequired));
14431
+ constraints.push(where26("isRequired", "==", isRequired));
14298
14432
  }
14299
14433
  if (sortingOrder !== void 0) {
14300
- constraints.push(where25("sortingOrder", "==", sortingOrder));
14434
+ constraints.push(where26("sortingOrder", "==", sortingOrder));
14301
14435
  }
14302
- const q = query25(this.collectionRef, ...constraints.filter((c) => c));
14436
+ const q = query26(this.collectionRef, ...constraints.filter((c) => c));
14303
14437
  const snapshot = await getCountFromServer(q);
14304
14438
  return snapshot.data().count;
14305
14439
  }
@@ -14308,12 +14442,12 @@ var DocumentationTemplateService = class extends BaseService {
14308
14442
  * @returns A promise that resolves to an array of all active templates.
14309
14443
  */
14310
14444
  async getAllActiveTemplates() {
14311
- const q = query25(
14445
+ const q = query26(
14312
14446
  this.collectionRef,
14313
- where25("isActive", "==", true),
14314
- orderBy13("title", "asc")
14447
+ where26("isActive", "==", true),
14448
+ orderBy14("title", "asc")
14315
14449
  );
14316
- const querySnapshot = await getDocs25(q);
14450
+ const querySnapshot = await getDocs26(q);
14317
14451
  const templates = [];
14318
14452
  querySnapshot.forEach((doc38) => {
14319
14453
  templates.push(doc38.data());
@@ -14328,17 +14462,17 @@ var DocumentationTemplateService = class extends BaseService {
14328
14462
  * @returns Array of templates and the last document for pagination
14329
14463
  */
14330
14464
  async getTemplatesByTags(tags, pageSize = 20, lastDoc) {
14331
- let q = query25(
14465
+ let q = query26(
14332
14466
  this.collectionRef,
14333
- where25("isActive", "==", true),
14334
- where25("tags", "array-contains-any", tags),
14335
- orderBy13("updatedAt", "desc"),
14336
- limit12(pageSize)
14467
+ where26("isActive", "==", true),
14468
+ where26("tags", "array-contains-any", tags),
14469
+ orderBy14("updatedAt", "desc"),
14470
+ limit13(pageSize)
14337
14471
  );
14338
14472
  if (lastDoc) {
14339
- q = query25(q, startAfter10(lastDoc));
14473
+ q = query26(q, startAfter11(lastDoc));
14340
14474
  }
14341
- const querySnapshot = await getDocs25(q);
14475
+ const querySnapshot = await getDocs26(q);
14342
14476
  const templates = [];
14343
14477
  let lastVisible = null;
14344
14478
  querySnapshot.forEach((doc38) => {
@@ -14358,16 +14492,16 @@ var DocumentationTemplateService = class extends BaseService {
14358
14492
  * @returns Array of templates and the last document for pagination
14359
14493
  */
14360
14494
  async getTemplatesByCreator(userId, pageSize = 20, lastDoc) {
14361
- let q = query25(
14495
+ let q = query26(
14362
14496
  this.collectionRef,
14363
- where25("createdBy", "==", userId),
14364
- orderBy13("updatedAt", "desc"),
14365
- limit12(pageSize)
14497
+ where26("createdBy", "==", userId),
14498
+ orderBy14("updatedAt", "desc"),
14499
+ limit13(pageSize)
14366
14500
  );
14367
14501
  if (lastDoc) {
14368
- q = query25(q, startAfter10(lastDoc));
14502
+ q = query26(q, startAfter11(lastDoc));
14369
14503
  }
14370
- const querySnapshot = await getDocs25(q);
14504
+ const querySnapshot = await getDocs26(q);
14371
14505
  const templates = [];
14372
14506
  let lastVisible = null;
14373
14507
  querySnapshot.forEach((doc38) => {
@@ -14385,18 +14519,18 @@ var DocumentationTemplateService = class extends BaseService {
14385
14519
  * @returns Array of templates
14386
14520
  */
14387
14521
  async getAllTemplatesForSelection(options) {
14388
- let q = query25(
14522
+ let q = query26(
14389
14523
  this.collectionRef,
14390
- where25("isActive", "==", true),
14391
- orderBy13("updatedAt", "desc")
14524
+ where26("isActive", "==", true),
14525
+ orderBy14("updatedAt", "desc")
14392
14526
  );
14393
14527
  if ((options == null ? void 0 : options.isUserForm) !== void 0) {
14394
- q = query25(q, where25("isUserForm", "==", options.isUserForm));
14528
+ q = query26(q, where26("isUserForm", "==", options.isUserForm));
14395
14529
  }
14396
14530
  if ((options == null ? void 0 : options.isRequired) !== void 0) {
14397
- q = query25(q, where25("isRequired", "==", options.isRequired));
14531
+ q = query26(q, where26("isRequired", "==", options.isRequired));
14398
14532
  }
14399
- const querySnapshot = await getDocs25(q);
14533
+ const querySnapshot = await getDocs26(q);
14400
14534
  const templates = [];
14401
14535
  querySnapshot.forEach((doc38) => {
14402
14536
  templates.push(doc38.data());
@@ -14407,16 +14541,16 @@ var DocumentationTemplateService = class extends BaseService {
14407
14541
 
14408
14542
  // src/services/documentation-templates/filled-document.service.ts
14409
14543
  import {
14410
- collection as collection26,
14544
+ collection as collection27,
14411
14545
  doc as doc27,
14412
14546
  getDoc as getDoc29,
14413
- getDocs as getDocs26,
14547
+ getDocs as getDocs27,
14414
14548
  setDoc as setDoc25,
14415
14549
  updateDoc as updateDoc26,
14416
- query as query26,
14417
- orderBy as orderBy14,
14418
- limit as limit13,
14419
- startAfter as startAfter11
14550
+ query as query27,
14551
+ orderBy as orderBy15,
14552
+ limit as limit14,
14553
+ startAfter as startAfter12
14420
14554
  } from "firebase/firestore";
14421
14555
  var FilledDocumentService = class extends BaseService {
14422
14556
  constructor(...args) {
@@ -14559,20 +14693,20 @@ var FilledDocumentService = class extends BaseService {
14559
14693
  * @param lastDoc Last document from previous page for pagination.
14560
14694
  */
14561
14695
  async getFilledUserFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
14562
- const subcollectionRef = collection26(
14696
+ const subcollectionRef = collection27(
14563
14697
  this.db,
14564
14698
  APPOINTMENTS_COLLECTION,
14565
14699
  // Replaced "appointments"
14566
14700
  appointmentId,
14567
14701
  USER_FORMS_SUBCOLLECTION
14568
14702
  );
14569
- let q = query26(
14703
+ let q = query27(
14570
14704
  subcollectionRef,
14571
- orderBy14("updatedAt", "desc"),
14572
- limit13(pageSize)
14705
+ orderBy15("updatedAt", "desc"),
14706
+ limit14(pageSize)
14573
14707
  );
14574
14708
  if (lastDoc) {
14575
- q = query26(q, startAfter11(lastDoc));
14709
+ q = query27(q, startAfter12(lastDoc));
14576
14710
  }
14577
14711
  return this.executeQuery(q);
14578
14712
  }
@@ -14583,26 +14717,26 @@ var FilledDocumentService = class extends BaseService {
14583
14717
  * @param lastDoc Last document from previous page for pagination.
14584
14718
  */
14585
14719
  async getFilledDoctorFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
14586
- const subcollectionRef = collection26(
14720
+ const subcollectionRef = collection27(
14587
14721
  this.db,
14588
14722
  APPOINTMENTS_COLLECTION,
14589
14723
  // Replaced "appointments"
14590
14724
  appointmentId,
14591
14725
  DOCTOR_FORMS_SUBCOLLECTION
14592
14726
  );
14593
- let q = query26(
14727
+ let q = query27(
14594
14728
  subcollectionRef,
14595
- orderBy14("updatedAt", "desc"),
14596
- limit13(pageSize)
14729
+ orderBy15("updatedAt", "desc"),
14730
+ limit14(pageSize)
14597
14731
  );
14598
14732
  if (lastDoc) {
14599
- q = query26(q, startAfter11(lastDoc));
14733
+ q = query27(q, startAfter12(lastDoc));
14600
14734
  }
14601
14735
  return this.executeQuery(q);
14602
14736
  }
14603
14737
  // Helper to execute query and return documents + lastDoc
14604
14738
  async executeQuery(q) {
14605
- const querySnapshot = await getDocs26(q);
14739
+ const querySnapshot = await getDocs27(q);
14606
14740
  const documents = [];
14607
14741
  let lastVisible = null;
14608
14742
  querySnapshot.forEach((doc38) => {
@@ -14767,15 +14901,15 @@ var FilledDocumentService = class extends BaseService {
14767
14901
 
14768
14902
  // src/services/notifications/notification.service.ts
14769
14903
  import {
14770
- collection as collection27,
14904
+ collection as collection28,
14771
14905
  doc as doc28,
14772
14906
  getDoc as getDoc30,
14773
- getDocs as getDocs27,
14774
- query as query27,
14775
- where as where27,
14907
+ getDocs as getDocs28,
14908
+ query as query28,
14909
+ where as where28,
14776
14910
  updateDoc as updateDoc27,
14777
14911
  deleteDoc as deleteDoc17,
14778
- orderBy as orderBy15,
14912
+ orderBy as orderBy16,
14779
14913
  Timestamp as Timestamp30,
14780
14914
  addDoc as addDoc2,
14781
14915
  writeBatch as writeBatch5
@@ -14785,7 +14919,7 @@ var NotificationService = class extends BaseService {
14785
14919
  * Kreira novu notifikaciju
14786
14920
  */
14787
14921
  async createNotification(notification) {
14788
- const notificationsRef = collection27(this.db, NOTIFICATIONS_COLLECTION);
14922
+ const notificationsRef = collection28(this.db, NOTIFICATIONS_COLLECTION);
14789
14923
  const now = Timestamp30.now();
14790
14924
  const notificationData = {
14791
14925
  ...notification,
@@ -14823,12 +14957,12 @@ var NotificationService = class extends BaseService {
14823
14957
  * Dohvata sve notifikacije za korisnika
14824
14958
  */
14825
14959
  async getUserNotifications(userId) {
14826
- const q = query27(
14827
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14828
- where27("userId", "==", userId),
14829
- orderBy15("notificationTime", "desc")
14960
+ const q = query28(
14961
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
14962
+ where28("userId", "==", userId),
14963
+ orderBy16("notificationTime", "desc")
14830
14964
  );
14831
- const querySnapshot = await getDocs27(q);
14965
+ const querySnapshot = await getDocs28(q);
14832
14966
  return querySnapshot.docs.map((doc38) => ({
14833
14967
  id: doc38.id,
14834
14968
  ...doc38.data()
@@ -14838,13 +14972,13 @@ var NotificationService = class extends BaseService {
14838
14972
  * Dohvata nepročitane notifikacije za korisnika
14839
14973
  */
14840
14974
  async getUnreadNotifications(userId) {
14841
- const q = query27(
14842
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14843
- where27("userId", "==", userId),
14844
- where27("isRead", "==", false),
14845
- orderBy15("notificationTime", "desc")
14975
+ const q = query28(
14976
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
14977
+ where28("userId", "==", userId),
14978
+ where28("isRead", "==", false),
14979
+ orderBy16("notificationTime", "desc")
14846
14980
  );
14847
- const querySnapshot = await getDocs27(q);
14981
+ const querySnapshot = await getDocs28(q);
14848
14982
  return querySnapshot.docs.map((doc38) => ({
14849
14983
  id: doc38.id,
14850
14984
  ...doc38.data()
@@ -14912,13 +15046,13 @@ var NotificationService = class extends BaseService {
14912
15046
  * Dohvata notifikacije po tipu
14913
15047
  */
14914
15048
  async getNotificationsByType(userId, type) {
14915
- const q = query27(
14916
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14917
- where27("userId", "==", userId),
14918
- where27("notificationType", "==", type),
14919
- orderBy15("notificationTime", "desc")
15049
+ const q = query28(
15050
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
15051
+ where28("userId", "==", userId),
15052
+ where28("notificationType", "==", type),
15053
+ orderBy16("notificationTime", "desc")
14920
15054
  );
14921
- const querySnapshot = await getDocs27(q);
15055
+ const querySnapshot = await getDocs28(q);
14922
15056
  return querySnapshot.docs.map((doc38) => ({
14923
15057
  id: doc38.id,
14924
15058
  ...doc38.data()
@@ -14928,12 +15062,12 @@ var NotificationService = class extends BaseService {
14928
15062
  * Dohvata notifikacije za određeni termin
14929
15063
  */
14930
15064
  async getAppointmentNotifications(appointmentId) {
14931
- const q = query27(
14932
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14933
- where27("appointmentId", "==", appointmentId),
14934
- orderBy15("notificationTime", "desc")
15065
+ const q = query28(
15066
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
15067
+ where28("appointmentId", "==", appointmentId),
15068
+ orderBy16("notificationTime", "desc")
14935
15069
  );
14936
- const querySnapshot = await getDocs27(q);
15070
+ const querySnapshot = await getDocs28(q);
14937
15071
  return querySnapshot.docs.map((doc38) => ({
14938
15072
  id: doc38.id,
14939
15073
  ...doc38.data()
@@ -14943,16 +15077,16 @@ var NotificationService = class extends BaseService {
14943
15077
 
14944
15078
  // src/services/patient/patientRequirements.service.ts
14945
15079
  import {
14946
- collection as collection28,
14947
- getDocs as getDocs28,
14948
- query as query28,
14949
- where as where28,
15080
+ collection as collection29,
15081
+ getDocs as getDocs29,
15082
+ query as query29,
15083
+ where as where29,
14950
15084
  doc as doc29,
14951
15085
  updateDoc as updateDoc28,
14952
15086
  Timestamp as Timestamp31,
14953
- orderBy as orderBy16,
14954
- limit as limit14,
14955
- startAfter as startAfter12,
15087
+ orderBy as orderBy17,
15088
+ limit as limit15,
15089
+ startAfter as startAfter13,
14956
15090
  getDoc as getDoc31
14957
15091
  } from "firebase/firestore";
14958
15092
  var PatientRequirementsService = class extends BaseService {
@@ -14960,7 +15094,7 @@ var PatientRequirementsService = class extends BaseService {
14960
15094
  super(db, auth, app);
14961
15095
  }
14962
15096
  getPatientRequirementsCollectionRef(patientId) {
14963
- return collection28(
15097
+ return collection29(
14964
15098
  this.db,
14965
15099
  `patients/${patientId}/${PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME}`
14966
15100
  );
@@ -14998,22 +15132,22 @@ var PatientRequirementsService = class extends BaseService {
14998
15132
  */
14999
15133
  async getAllPatientRequirementInstances(patientId, filters, pageLimit = 20, lastVisible) {
15000
15134
  const collRef = this.getPatientRequirementsCollectionRef(patientId);
15001
- let q = query28(collRef, orderBy16("createdAt", "desc"));
15135
+ let q = query29(collRef, orderBy17("createdAt", "desc"));
15002
15136
  const queryConstraints = [];
15003
15137
  if ((filters == null ? void 0 : filters.appointmentId) && filters.appointmentId !== "all") {
15004
15138
  queryConstraints.push(
15005
- where28("appointmentId", "==", filters.appointmentId)
15139
+ where29("appointmentId", "==", filters.appointmentId)
15006
15140
  );
15007
15141
  }
15008
15142
  if ((filters == null ? void 0 : filters.statuses) && filters.statuses.length > 0) {
15009
- queryConstraints.push(where28("overallStatus", "in", filters.statuses));
15143
+ queryConstraints.push(where29("overallStatus", "in", filters.statuses));
15010
15144
  }
15011
15145
  if (lastVisible) {
15012
- queryConstraints.push(startAfter12(lastVisible));
15146
+ queryConstraints.push(startAfter13(lastVisible));
15013
15147
  }
15014
- queryConstraints.push(limit14(pageLimit));
15015
- q = query28(collRef, ...queryConstraints);
15016
- const snapshot = await getDocs28(q);
15148
+ queryConstraints.push(limit15(pageLimit));
15149
+ q = query29(collRef, ...queryConstraints);
15150
+ const snapshot = await getDocs29(q);
15017
15151
  let requirements = snapshot.docs.map((docSnap) => {
15018
15152
  const data = docSnap.data();
15019
15153
  return { id: docSnap.id, ...data };
@@ -15125,20 +15259,20 @@ var PatientRequirementsService = class extends BaseService {
15125
15259
 
15126
15260
  // src/services/procedure/procedure.service.ts
15127
15261
  import {
15128
- collection as collection29,
15262
+ collection as collection30,
15129
15263
  doc as doc30,
15130
15264
  getDoc as getDoc32,
15131
- getDocs as getDocs29,
15132
- query as query29,
15133
- where as where29,
15265
+ getDocs as getDocs30,
15266
+ query as query30,
15267
+ where as where30,
15134
15268
  updateDoc as updateDoc29,
15135
15269
  setDoc as setDoc26,
15136
15270
  deleteDoc as deleteDoc18,
15137
15271
  serverTimestamp as serverTimestamp25,
15138
15272
  writeBatch as writeBatch6,
15139
- orderBy as orderBy17,
15140
- limit as limit15,
15141
- startAfter as startAfter13,
15273
+ orderBy as orderBy18,
15274
+ limit as limit16,
15275
+ startAfter as startAfter14,
15142
15276
  documentId as documentId2
15143
15277
  } from "firebase/firestore";
15144
15278
 
@@ -15522,11 +15656,11 @@ var ProcedureService = class extends BaseService {
15522
15656
  const practitionersMap = /* @__PURE__ */ new Map();
15523
15657
  for (let i = 0; i < practitionerIds.length; i += 30) {
15524
15658
  const chunk = practitionerIds.slice(i, i + 30);
15525
- const practitionersQuery = query29(
15526
- collection29(this.db, PRACTITIONERS_COLLECTION),
15527
- where29(documentId2(), "in", chunk)
15659
+ const practitionersQuery = query30(
15660
+ collection30(this.db, PRACTITIONERS_COLLECTION),
15661
+ where30(documentId2(), "in", chunk)
15528
15662
  );
15529
- const practitionersSnapshot = await getDocs29(practitionersQuery);
15663
+ const practitionersSnapshot = await getDocs30(practitionersQuery);
15530
15664
  practitionersSnapshot.docs.forEach((doc38) => {
15531
15665
  practitionersMap.set(doc38.id, doc38.data());
15532
15666
  });
@@ -15607,8 +15741,8 @@ var ProcedureService = class extends BaseService {
15607
15741
  const fetchedProcedures = [];
15608
15742
  for (let i = 0; i < createdProcedureIds.length; i += 30) {
15609
15743
  const chunk = createdProcedureIds.slice(i, i + 30);
15610
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), where29(documentId2(), "in", chunk));
15611
- const snapshot = await getDocs29(q);
15744
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), where30(documentId2(), "in", chunk));
15745
+ const snapshot = await getDocs30(q);
15612
15746
  snapshot.forEach((doc38) => {
15613
15747
  fetchedProcedures.push(doc38.data());
15614
15748
  });
@@ -15634,12 +15768,12 @@ var ProcedureService = class extends BaseService {
15634
15768
  * @returns List of procedures
15635
15769
  */
15636
15770
  async getProceduresByClinicBranch(clinicBranchId) {
15637
- const q = query29(
15638
- collection29(this.db, PROCEDURES_COLLECTION),
15639
- where29("clinicBranchId", "==", clinicBranchId),
15640
- where29("isActive", "==", true)
15771
+ const q = query30(
15772
+ collection30(this.db, PROCEDURES_COLLECTION),
15773
+ where30("clinicBranchId", "==", clinicBranchId),
15774
+ where30("isActive", "==", true)
15641
15775
  );
15642
- const snapshot = await getDocs29(q);
15776
+ const snapshot = await getDocs30(q);
15643
15777
  return snapshot.docs.map((doc38) => doc38.data());
15644
15778
  }
15645
15779
  /**
@@ -15648,12 +15782,12 @@ var ProcedureService = class extends BaseService {
15648
15782
  * @returns List of procedures
15649
15783
  */
15650
15784
  async getProceduresByPractitioner(practitionerId) {
15651
- const q = query29(
15652
- collection29(this.db, PROCEDURES_COLLECTION),
15653
- where29("practitionerId", "==", practitionerId),
15654
- where29("isActive", "==", true)
15785
+ const q = query30(
15786
+ collection30(this.db, PROCEDURES_COLLECTION),
15787
+ where30("practitionerId", "==", practitionerId),
15788
+ where30("isActive", "==", true)
15655
15789
  );
15656
- const snapshot = await getDocs29(q);
15790
+ const snapshot = await getDocs30(q);
15657
15791
  return snapshot.docs.map((doc38) => doc38.data());
15658
15792
  }
15659
15793
  /**
@@ -15662,12 +15796,12 @@ var ProcedureService = class extends BaseService {
15662
15796
  * @returns List of inactive procedures
15663
15797
  */
15664
15798
  async getInactiveProceduresByPractitioner(practitionerId) {
15665
- const q = query29(
15666
- collection29(this.db, PROCEDURES_COLLECTION),
15667
- where29("practitionerId", "==", practitionerId),
15668
- where29("isActive", "==", false)
15799
+ const q = query30(
15800
+ collection30(this.db, PROCEDURES_COLLECTION),
15801
+ where30("practitionerId", "==", practitionerId),
15802
+ where30("isActive", "==", false)
15669
15803
  );
15670
- const snapshot = await getDocs29(q);
15804
+ const snapshot = await getDocs30(q);
15671
15805
  return snapshot.docs.map((doc38) => doc38.data());
15672
15806
  }
15673
15807
  /**
@@ -15867,25 +16001,25 @@ var ProcedureService = class extends BaseService {
15867
16001
  */
15868
16002
  async getAllProcedures(pagination, lastDoc) {
15869
16003
  try {
15870
- const proceduresCollection = collection29(this.db, PROCEDURES_COLLECTION);
15871
- let proceduresQuery = query29(proceduresCollection);
16004
+ const proceduresCollection = collection30(this.db, PROCEDURES_COLLECTION);
16005
+ let proceduresQuery = query30(proceduresCollection);
15872
16006
  if (pagination && pagination > 0) {
15873
- const { limit: limit21, startAfter: startAfter19 } = await import("firebase/firestore");
16007
+ const { limit: limit22, startAfter: startAfter20 } = await import("firebase/firestore");
15874
16008
  if (lastDoc) {
15875
- proceduresQuery = query29(
16009
+ proceduresQuery = query30(
15876
16010
  proceduresCollection,
15877
- orderBy17("name"),
16011
+ orderBy18("name"),
15878
16012
  // Use imported orderBy
15879
- startAfter19(lastDoc),
15880
- limit21(pagination)
16013
+ startAfter20(lastDoc),
16014
+ limit22(pagination)
15881
16015
  );
15882
16016
  } else {
15883
- proceduresQuery = query29(proceduresCollection, orderBy17("name"), limit21(pagination));
16017
+ proceduresQuery = query30(proceduresCollection, orderBy18("name"), limit22(pagination));
15884
16018
  }
15885
16019
  } else {
15886
- proceduresQuery = query29(proceduresCollection, orderBy17("name"));
16020
+ proceduresQuery = query30(proceduresCollection, orderBy18("name"));
15887
16021
  }
15888
- const proceduresSnapshot = await getDocs29(proceduresQuery);
16022
+ const proceduresSnapshot = await getDocs30(proceduresQuery);
15889
16023
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
15890
16024
  const procedures = proceduresSnapshot.docs.map((doc38) => {
15891
16025
  const data = doc38.data();
@@ -15949,37 +16083,37 @@ var ProcedureService = class extends BaseService {
15949
16083
  const getBaseConstraints = () => {
15950
16084
  const constraints = [];
15951
16085
  if (filters.isActive !== void 0) {
15952
- constraints.push(where29("isActive", "==", filters.isActive));
16086
+ constraints.push(where30("isActive", "==", filters.isActive));
15953
16087
  } else {
15954
- constraints.push(where29("isActive", "==", true));
16088
+ constraints.push(where30("isActive", "==", true));
15955
16089
  }
15956
16090
  if (filters.procedureFamily) {
15957
- constraints.push(where29("family", "==", filters.procedureFamily));
16091
+ constraints.push(where30("family", "==", filters.procedureFamily));
15958
16092
  }
15959
16093
  if (filters.procedureCategory) {
15960
- constraints.push(where29("category.id", "==", filters.procedureCategory));
16094
+ constraints.push(where30("category.id", "==", filters.procedureCategory));
15961
16095
  }
15962
16096
  if (filters.procedureSubcategory) {
15963
- constraints.push(where29("subcategory.id", "==", filters.procedureSubcategory));
16097
+ constraints.push(where30("subcategory.id", "==", filters.procedureSubcategory));
15964
16098
  }
15965
16099
  if (filters.procedureTechnology) {
15966
- constraints.push(where29("technology.id", "==", filters.procedureTechnology));
16100
+ constraints.push(where30("technology.id", "==", filters.procedureTechnology));
15967
16101
  }
15968
16102
  if (filters.minPrice !== void 0) {
15969
- constraints.push(where29("price", ">=", filters.minPrice));
16103
+ constraints.push(where30("price", ">=", filters.minPrice));
15970
16104
  }
15971
16105
  if (filters.maxPrice !== void 0) {
15972
- constraints.push(where29("price", "<=", filters.maxPrice));
16106
+ constraints.push(where30("price", "<=", filters.maxPrice));
15973
16107
  }
15974
16108
  if (filters.minRating !== void 0) {
15975
- constraints.push(where29("reviewInfo.averageRating", ">=", filters.minRating));
16109
+ constraints.push(where30("reviewInfo.averageRating", ">=", filters.minRating));
15976
16110
  }
15977
16111
  if (filters.maxRating !== void 0) {
15978
- constraints.push(where29("reviewInfo.averageRating", "<=", filters.maxRating));
16112
+ constraints.push(where30("reviewInfo.averageRating", "<=", filters.maxRating));
15979
16113
  }
15980
16114
  if (filters.treatmentBenefits && filters.treatmentBenefits.length > 0) {
15981
16115
  const benefitIdsToMatch = filters.treatmentBenefits;
15982
- constraints.push(where29("treatmentBenefitIds", "array-contains-any", benefitIdsToMatch));
16116
+ constraints.push(where30("treatmentBenefitIds", "array-contains-any", benefitIdsToMatch));
15983
16117
  }
15984
16118
  return constraints;
15985
16119
  };
@@ -15988,21 +16122,21 @@ var ProcedureService = class extends BaseService {
15988
16122
  console.log("[PROCEDURE_SERVICE] Strategy 1: Trying nameLower search");
15989
16123
  const searchTerm = filters.nameSearch.trim().toLowerCase();
15990
16124
  const constraints = getBaseConstraints();
15991
- constraints.push(where29("nameLower", ">=", searchTerm));
15992
- constraints.push(where29("nameLower", "<=", searchTerm + "\uF8FF"));
15993
- constraints.push(orderBy17("nameLower"));
16125
+ constraints.push(where30("nameLower", ">=", searchTerm));
16126
+ constraints.push(where30("nameLower", "<=", searchTerm + "\uF8FF"));
16127
+ constraints.push(orderBy18("nameLower"));
15994
16128
  if (filters.lastDoc) {
15995
16129
  if (typeof filters.lastDoc.data === "function") {
15996
- constraints.push(startAfter13(filters.lastDoc));
16130
+ constraints.push(startAfter14(filters.lastDoc));
15997
16131
  } else if (Array.isArray(filters.lastDoc)) {
15998
- constraints.push(startAfter13(...filters.lastDoc));
16132
+ constraints.push(startAfter14(...filters.lastDoc));
15999
16133
  } else {
16000
- constraints.push(startAfter13(filters.lastDoc));
16134
+ constraints.push(startAfter14(filters.lastDoc));
16001
16135
  }
16002
16136
  }
16003
- constraints.push(limit15(filters.pagination || 10));
16004
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16005
- const querySnapshot = await getDocs29(q);
16137
+ constraints.push(limit16(filters.pagination || 10));
16138
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16139
+ const querySnapshot = await getDocs30(q);
16006
16140
  const procedures = querySnapshot.docs.map(
16007
16141
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16008
16142
  );
@@ -16021,21 +16155,21 @@ var ProcedureService = class extends BaseService {
16021
16155
  console.log("[PROCEDURE_SERVICE] Strategy 2: Trying name field search");
16022
16156
  const searchTerm = filters.nameSearch.trim().toLowerCase();
16023
16157
  const constraints = getBaseConstraints();
16024
- constraints.push(where29("name", ">=", searchTerm));
16025
- constraints.push(where29("name", "<=", searchTerm + "\uF8FF"));
16026
- constraints.push(orderBy17("name"));
16158
+ constraints.push(where30("name", ">=", searchTerm));
16159
+ constraints.push(where30("name", "<=", searchTerm + "\uF8FF"));
16160
+ constraints.push(orderBy18("name"));
16027
16161
  if (filters.lastDoc) {
16028
16162
  if (typeof filters.lastDoc.data === "function") {
16029
- constraints.push(startAfter13(filters.lastDoc));
16163
+ constraints.push(startAfter14(filters.lastDoc));
16030
16164
  } else if (Array.isArray(filters.lastDoc)) {
16031
- constraints.push(startAfter13(...filters.lastDoc));
16165
+ constraints.push(startAfter14(...filters.lastDoc));
16032
16166
  } else {
16033
- constraints.push(startAfter13(filters.lastDoc));
16167
+ constraints.push(startAfter14(filters.lastDoc));
16034
16168
  }
16035
16169
  }
16036
- constraints.push(limit15(filters.pagination || 10));
16037
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16038
- const querySnapshot = await getDocs29(q);
16170
+ constraints.push(limit16(filters.pagination || 10));
16171
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16172
+ const querySnapshot = await getDocs30(q);
16039
16173
  const procedures = querySnapshot.docs.map(
16040
16174
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16041
16175
  );
@@ -16054,19 +16188,19 @@ var ProcedureService = class extends BaseService {
16054
16188
  "[PROCEDURE_SERVICE] Strategy 3: Using createdAt orderBy with client-side filtering"
16055
16189
  );
16056
16190
  const constraints = getBaseConstraints();
16057
- constraints.push(orderBy17("createdAt", "desc"));
16191
+ constraints.push(orderBy18("createdAt", "desc"));
16058
16192
  if (filters.lastDoc) {
16059
16193
  if (typeof filters.lastDoc.data === "function") {
16060
- constraints.push(startAfter13(filters.lastDoc));
16194
+ constraints.push(startAfter14(filters.lastDoc));
16061
16195
  } else if (Array.isArray(filters.lastDoc)) {
16062
- constraints.push(startAfter13(...filters.lastDoc));
16196
+ constraints.push(startAfter14(...filters.lastDoc));
16063
16197
  } else {
16064
- constraints.push(startAfter13(filters.lastDoc));
16198
+ constraints.push(startAfter14(filters.lastDoc));
16065
16199
  }
16066
16200
  }
16067
- constraints.push(limit15(filters.pagination || 10));
16068
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16069
- const querySnapshot = await getDocs29(q);
16201
+ constraints.push(limit16(filters.pagination || 10));
16202
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16203
+ const querySnapshot = await getDocs30(q);
16070
16204
  let procedures = querySnapshot.docs.map(
16071
16205
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16072
16206
  );
@@ -16083,12 +16217,12 @@ var ProcedureService = class extends BaseService {
16083
16217
  try {
16084
16218
  console.log("[PROCEDURE_SERVICE] Strategy 4: Minimal query fallback");
16085
16219
  const constraints = [
16086
- where29("isActive", "==", true),
16087
- orderBy17("createdAt", "desc"),
16088
- limit15(filters.pagination || 10)
16220
+ where30("isActive", "==", true),
16221
+ orderBy18("createdAt", "desc"),
16222
+ limit16(filters.pagination || 10)
16089
16223
  ];
16090
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16091
- const querySnapshot = await getDocs29(q);
16224
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16225
+ const querySnapshot = await getDocs30(q);
16092
16226
  let procedures = querySnapshot.docs.map(
16093
16227
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16094
16228
  );
@@ -16232,11 +16366,11 @@ var ProcedureService = class extends BaseService {
16232
16366
  const bounds = geohashQueryBounds5([location.latitude, location.longitude], radiusInKm * 1e3);
16233
16367
  const fetches = bounds.map((b) => {
16234
16368
  const constraints = [
16235
- where29("clinicInfo.location.geohash", ">=", b[0]),
16236
- where29("clinicInfo.location.geohash", "<=", b[1]),
16237
- where29("isActive", "==", filters.isActive !== void 0 ? filters.isActive : true)
16369
+ where30("clinicInfo.location.geohash", ">=", b[0]),
16370
+ where30("clinicInfo.location.geohash", "<=", b[1]),
16371
+ where30("isActive", "==", filters.isActive !== void 0 ? filters.isActive : true)
16238
16372
  ];
16239
- return getDocs29(query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints));
16373
+ return getDocs30(query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints));
16240
16374
  });
16241
16375
  return Promise.all(fetches).then((snaps) => {
16242
16376
  const collected = [];
@@ -16388,8 +16522,8 @@ var ProcedureService = class extends BaseService {
16388
16522
  * @returns Array of minimal procedure info for map
16389
16523
  */
16390
16524
  async getProceduresForMap() {
16391
- const proceduresRef = collection29(this.db, PROCEDURES_COLLECTION);
16392
- const snapshot = await getDocs29(proceduresRef);
16525
+ const proceduresRef = collection30(this.db, PROCEDURES_COLLECTION);
16526
+ const snapshot = await getDocs30(proceduresRef);
16393
16527
  const proceduresForMap = snapshot.docs.map((doc38) => {
16394
16528
  var _a, _b, _c, _d, _e, _f, _g, _h;
16395
16529
  const data = doc38.data();
@@ -16409,12 +16543,12 @@ var ProcedureService = class extends BaseService {
16409
16543
 
16410
16544
  // src/services/reviews/reviews.service.ts
16411
16545
  import {
16412
- collection as collection30,
16546
+ collection as collection31,
16413
16547
  doc as doc31,
16414
16548
  getDoc as getDoc33,
16415
- getDocs as getDocs30,
16416
- query as query30,
16417
- where as where30,
16549
+ getDocs as getDocs31,
16550
+ query as query31,
16551
+ where as where31,
16418
16552
  setDoc as setDoc27,
16419
16553
  deleteDoc as deleteDoc19,
16420
16554
  serverTimestamp as serverTimestamp26
@@ -16531,11 +16665,11 @@ var ReviewService = class extends BaseService {
16531
16665
  * @returns Array of reviews for the patient
16532
16666
  */
16533
16667
  async getReviewsByPatient(patientId) {
16534
- const q = query30(
16535
- collection30(this.db, REVIEWS_COLLECTION),
16536
- where30("patientId", "==", patientId)
16668
+ const q = query31(
16669
+ collection31(this.db, REVIEWS_COLLECTION),
16670
+ where31("patientId", "==", patientId)
16537
16671
  );
16538
- const snapshot = await getDocs30(q);
16672
+ const snapshot = await getDocs31(q);
16539
16673
  return snapshot.docs.map((doc38) => doc38.data());
16540
16674
  }
16541
16675
  /**
@@ -16544,11 +16678,11 @@ var ReviewService = class extends BaseService {
16544
16678
  * @returns Array of reviews containing clinic reviews
16545
16679
  */
16546
16680
  async getReviewsByClinic(clinicId) {
16547
- const q = query30(
16548
- collection30(this.db, REVIEWS_COLLECTION),
16549
- where30("clinicReview.clinicId", "==", clinicId)
16681
+ const q = query31(
16682
+ collection31(this.db, REVIEWS_COLLECTION),
16683
+ where31("clinicReview.clinicId", "==", clinicId)
16550
16684
  );
16551
- const snapshot = await getDocs30(q);
16685
+ const snapshot = await getDocs31(q);
16552
16686
  return snapshot.docs.map((doc38) => doc38.data());
16553
16687
  }
16554
16688
  /**
@@ -16557,11 +16691,11 @@ var ReviewService = class extends BaseService {
16557
16691
  * @returns Array of reviews containing practitioner reviews
16558
16692
  */
16559
16693
  async getReviewsByPractitioner(practitionerId) {
16560
- const q = query30(
16561
- collection30(this.db, REVIEWS_COLLECTION),
16562
- where30("practitionerReview.practitionerId", "==", practitionerId)
16694
+ const q = query31(
16695
+ collection31(this.db, REVIEWS_COLLECTION),
16696
+ where31("practitionerReview.practitionerId", "==", practitionerId)
16563
16697
  );
16564
- const snapshot = await getDocs30(q);
16698
+ const snapshot = await getDocs31(q);
16565
16699
  return snapshot.docs.map((doc38) => doc38.data());
16566
16700
  }
16567
16701
  /**
@@ -16570,11 +16704,11 @@ var ReviewService = class extends BaseService {
16570
16704
  * @returns Array of reviews containing procedure reviews
16571
16705
  */
16572
16706
  async getReviewsByProcedure(procedureId) {
16573
- const q = query30(
16574
- collection30(this.db, REVIEWS_COLLECTION),
16575
- where30("procedureReview.procedureId", "==", procedureId)
16707
+ const q = query31(
16708
+ collection31(this.db, REVIEWS_COLLECTION),
16709
+ where31("procedureReview.procedureId", "==", procedureId)
16576
16710
  );
16577
- const snapshot = await getDocs30(q);
16711
+ const snapshot = await getDocs31(q);
16578
16712
  return snapshot.docs.map((doc38) => doc38.data());
16579
16713
  }
16580
16714
  /**
@@ -16583,11 +16717,11 @@ var ReviewService = class extends BaseService {
16583
16717
  * @returns The review for the appointment if found, null otherwise
16584
16718
  */
16585
16719
  async getReviewByAppointment(appointmentId) {
16586
- const q = query30(
16587
- collection30(this.db, REVIEWS_COLLECTION),
16588
- where30("appointmentId", "==", appointmentId)
16720
+ const q = query31(
16721
+ collection31(this.db, REVIEWS_COLLECTION),
16722
+ where31("appointmentId", "==", appointmentId)
16589
16723
  );
16590
- const snapshot = await getDocs30(q);
16724
+ const snapshot = await getDocs31(q);
16591
16725
  if (snapshot.empty) {
16592
16726
  return null;
16593
16727
  }
@@ -16675,16 +16809,16 @@ var getFirebaseFunctions = async () => {
16675
16809
  // src/backoffice/services/brand.service.ts
16676
16810
  import {
16677
16811
  addDoc as addDoc3,
16678
- collection as collection31,
16812
+ collection as collection32,
16679
16813
  doc as doc32,
16680
16814
  getDoc as getDoc34,
16681
- getDocs as getDocs31,
16682
- query as query31,
16815
+ getDocs as getDocs32,
16816
+ query as query32,
16683
16817
  updateDoc as updateDoc30,
16684
- where as where31,
16685
- limit as limit16,
16686
- orderBy as orderBy18,
16687
- startAfter as startAfter14,
16818
+ where as where32,
16819
+ limit as limit17,
16820
+ orderBy as orderBy19,
16821
+ startAfter as startAfter15,
16688
16822
  getCountFromServer as getCountFromServer2
16689
16823
  } from "firebase/firestore";
16690
16824
 
@@ -16697,7 +16831,7 @@ var BrandService = class extends BaseService {
16697
16831
  * Gets reference to brands collection
16698
16832
  */
16699
16833
  getBrandsRef() {
16700
- return collection31(this.db, BRANDS_COLLECTION);
16834
+ return collection32(this.db, BRANDS_COLLECTION);
16701
16835
  }
16702
16836
  /**
16703
16837
  * Creates a new brand
@@ -16722,22 +16856,22 @@ var BrandService = class extends BaseService {
16722
16856
  */
16723
16857
  async getAll(rowsPerPage, searchTerm, lastVisible) {
16724
16858
  const constraints = [
16725
- where31("isActive", "==", true),
16726
- orderBy18("name_lowercase")
16859
+ where32("isActive", "==", true),
16860
+ orderBy19("name_lowercase")
16727
16861
  ];
16728
16862
  if (searchTerm) {
16729
16863
  const lowercasedSearchTerm = searchTerm.toLowerCase();
16730
- constraints.push(where31("name_lowercase", ">=", lowercasedSearchTerm));
16864
+ constraints.push(where32("name_lowercase", ">=", lowercasedSearchTerm));
16731
16865
  constraints.push(
16732
- where31("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16866
+ where32("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16733
16867
  );
16734
16868
  }
16735
16869
  if (lastVisible) {
16736
- constraints.push(startAfter14(lastVisible));
16870
+ constraints.push(startAfter15(lastVisible));
16737
16871
  }
16738
- constraints.push(limit16(rowsPerPage));
16739
- const q = query31(this.getBrandsRef(), ...constraints);
16740
- const snapshot = await getDocs31(q);
16872
+ constraints.push(limit17(rowsPerPage));
16873
+ const q = query32(this.getBrandsRef(), ...constraints);
16874
+ const snapshot = await getDocs32(q);
16741
16875
  const brands = snapshot.docs.map(
16742
16876
  (doc38) => ({
16743
16877
  id: doc38.id,
@@ -16752,15 +16886,15 @@ var BrandService = class extends BaseService {
16752
16886
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
16753
16887
  */
16754
16888
  async getBrandsCount(searchTerm) {
16755
- const constraints = [where31("isActive", "==", true)];
16889
+ const constraints = [where32("isActive", "==", true)];
16756
16890
  if (searchTerm) {
16757
16891
  const lowercasedSearchTerm = searchTerm.toLowerCase();
16758
- constraints.push(where31("name_lowercase", ">=", lowercasedSearchTerm));
16892
+ constraints.push(where32("name_lowercase", ">=", lowercasedSearchTerm));
16759
16893
  constraints.push(
16760
- where31("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16894
+ where32("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16761
16895
  );
16762
16896
  }
16763
- const q = query31(this.getBrandsRef(), ...constraints);
16897
+ const q = query32(this.getBrandsRef(), ...constraints);
16764
16898
  const snapshot = await getCountFromServer2(q);
16765
16899
  return snapshot.data().count;
16766
16900
  }
@@ -16768,12 +16902,12 @@ var BrandService = class extends BaseService {
16768
16902
  * Gets all active brands for filter dropdowns (not paginated).
16769
16903
  */
16770
16904
  async getAllForFilter() {
16771
- const q = query31(
16905
+ const q = query32(
16772
16906
  this.getBrandsRef(),
16773
- where31("isActive", "==", true),
16774
- orderBy18("name")
16907
+ where32("isActive", "==", true),
16908
+ orderBy19("name")
16775
16909
  );
16776
- const snapshot = await getDocs31(q);
16910
+ const snapshot = await getDocs32(q);
16777
16911
  return snapshot.docs.map(
16778
16912
  (doc38) => ({
16779
16913
  id: doc38.id,
@@ -16821,17 +16955,17 @@ var BrandService = class extends BaseService {
16821
16955
  // src/backoffice/services/category.service.ts
16822
16956
  import {
16823
16957
  addDoc as addDoc4,
16824
- collection as collection32,
16958
+ collection as collection33,
16825
16959
  doc as doc33,
16826
16960
  getCountFromServer as getCountFromServer3,
16827
16961
  getDoc as getDoc35,
16828
- getDocs as getDocs32,
16829
- limit as limit17,
16830
- orderBy as orderBy19,
16831
- query as query32,
16832
- startAfter as startAfter15,
16962
+ getDocs as getDocs33,
16963
+ limit as limit18,
16964
+ orderBy as orderBy20,
16965
+ query as query33,
16966
+ startAfter as startAfter16,
16833
16967
  updateDoc as updateDoc31,
16834
- where as where32
16968
+ where as where33
16835
16969
  } from "firebase/firestore";
16836
16970
 
16837
16971
  // src/backoffice/types/category.types.ts
@@ -16843,7 +16977,7 @@ var CategoryService = class extends BaseService {
16843
16977
  * Referenca na Firestore kolekciju kategorija
16844
16978
  */
16845
16979
  get categoriesRef() {
16846
- return collection32(this.db, CATEGORIES_COLLECTION);
16980
+ return collection33(this.db, CATEGORIES_COLLECTION);
16847
16981
  }
16848
16982
  /**
16849
16983
  * Kreira novu kategoriju u sistemu
@@ -16870,10 +17004,10 @@ var CategoryService = class extends BaseService {
16870
17004
  const counts = {};
16871
17005
  const families = Object.values(ProcedureFamily);
16872
17006
  for (const family of families) {
16873
- const q = query32(
17007
+ const q = query33(
16874
17008
  this.categoriesRef,
16875
- where32("family", "==", family),
16876
- where32("isActive", "==", active)
17009
+ where33("family", "==", family),
17010
+ where33("isActive", "==", active)
16877
17011
  );
16878
17012
  const snapshot = await getCountFromServer3(q);
16879
17013
  counts[family] = snapshot.data().count;
@@ -16885,8 +17019,8 @@ var CategoryService = class extends BaseService {
16885
17019
  * @returns Lista svih aktivnih kategorija
16886
17020
  */
16887
17021
  async getAllForFilter() {
16888
- const q = query32(this.categoriesRef, where32("isActive", "==", true));
16889
- const snapshot = await getDocs32(q);
17022
+ const q = query33(this.categoriesRef, where33("isActive", "==", true));
17023
+ const snapshot = await getDocs33(q);
16890
17024
  return snapshot.docs.map(
16891
17025
  (doc38) => ({
16892
17026
  id: doc38.id,
@@ -16900,13 +17034,13 @@ var CategoryService = class extends BaseService {
16900
17034
  * @returns Lista aktivnih kategorija koje pripadaju traženoj familiji
16901
17035
  */
16902
17036
  async getAllForFilterByFamily(family) {
16903
- const q = query32(
17037
+ const q = query33(
16904
17038
  this.categoriesRef,
16905
- where32("family", "==", family),
16906
- where32("isActive", "==", true),
16907
- orderBy19("name")
17039
+ where33("family", "==", family),
17040
+ where33("isActive", "==", true),
17041
+ orderBy20("name")
16908
17042
  );
16909
- const snapshot = await getDocs32(q);
17043
+ const snapshot = await getDocs33(q);
16910
17044
  return snapshot.docs.map(
16911
17045
  (doc38) => ({
16912
17046
  id: doc38.id,
@@ -16922,13 +17056,13 @@ var CategoryService = class extends BaseService {
16922
17056
  async getAll(options = {}) {
16923
17057
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
16924
17058
  const constraints = [
16925
- where32("isActive", "==", active),
16926
- orderBy19("name"),
16927
- queryLimit ? limit17(queryLimit) : void 0,
16928
- lastVisible ? startAfter15(lastVisible) : void 0
17059
+ where33("isActive", "==", active),
17060
+ orderBy20("name"),
17061
+ queryLimit ? limit18(queryLimit) : void 0,
17062
+ lastVisible ? startAfter16(lastVisible) : void 0
16929
17063
  ].filter((c) => !!c);
16930
- const q = query32(this.categoriesRef, ...constraints);
16931
- const snapshot = await getDocs32(q);
17064
+ const q = query33(this.categoriesRef, ...constraints);
17065
+ const snapshot = await getDocs33(q);
16932
17066
  const categories = snapshot.docs.map(
16933
17067
  (doc38) => ({
16934
17068
  id: doc38.id,
@@ -16947,14 +17081,14 @@ var CategoryService = class extends BaseService {
16947
17081
  async getAllByFamily(family, options = {}) {
16948
17082
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
16949
17083
  const constraints = [
16950
- where32("family", "==", family),
16951
- where32("isActive", "==", active),
16952
- orderBy19("name"),
16953
- queryLimit ? limit17(queryLimit) : void 0,
16954
- lastVisible ? startAfter15(lastVisible) : void 0
17084
+ where33("family", "==", family),
17085
+ where33("isActive", "==", active),
17086
+ orderBy20("name"),
17087
+ queryLimit ? limit18(queryLimit) : void 0,
17088
+ lastVisible ? startAfter16(lastVisible) : void 0
16955
17089
  ].filter((c) => !!c);
16956
- const q = query32(this.categoriesRef, ...constraints);
16957
- const snapshot = await getDocs32(q);
17090
+ const q = query33(this.categoriesRef, ...constraints);
17091
+ const snapshot = await getDocs33(q);
16958
17092
  const categories = snapshot.docs.map(
16959
17093
  (doc38) => ({
16960
17094
  id: doc38.id,
@@ -17012,20 +17146,20 @@ var CategoryService = class extends BaseService {
17012
17146
  // src/backoffice/services/subcategory.service.ts
17013
17147
  import {
17014
17148
  addDoc as addDoc5,
17015
- collection as collection33,
17149
+ collection as collection34,
17016
17150
  collectionGroup as collectionGroup2,
17017
17151
  deleteDoc as deleteDoc20,
17018
17152
  doc as doc34,
17019
17153
  getCountFromServer as getCountFromServer4,
17020
17154
  getDoc as getDoc36,
17021
- getDocs as getDocs33,
17022
- limit as limit18,
17023
- orderBy as orderBy20,
17024
- query as query33,
17155
+ getDocs as getDocs34,
17156
+ limit as limit19,
17157
+ orderBy as orderBy21,
17158
+ query as query34,
17025
17159
  setDoc as setDoc28,
17026
- startAfter as startAfter16,
17160
+ startAfter as startAfter17,
17027
17161
  updateDoc as updateDoc32,
17028
- where as where33
17162
+ where as where34
17029
17163
  } from "firebase/firestore";
17030
17164
 
17031
17165
  // src/backoffice/types/subcategory.types.ts
@@ -17038,7 +17172,7 @@ var SubcategoryService = class extends BaseService {
17038
17172
  * @param categoryId - ID roditeljske kategorije
17039
17173
  */
17040
17174
  getSubcategoriesRef(categoryId) {
17041
- return collection33(
17175
+ return collection34(
17042
17176
  this.db,
17043
17177
  CATEGORIES_COLLECTION,
17044
17178
  categoryId,
@@ -17072,13 +17206,13 @@ var SubcategoryService = class extends BaseService {
17072
17206
  * @returns A record mapping category ID to subcategory count.
17073
17207
  */
17074
17208
  async getSubcategoryCounts(active = true) {
17075
- const categoriesRef = collection33(this.db, CATEGORIES_COLLECTION);
17076
- const categoriesSnapshot = await getDocs33(categoriesRef);
17209
+ const categoriesRef = collection34(this.db, CATEGORIES_COLLECTION);
17210
+ const categoriesSnapshot = await getDocs34(categoriesRef);
17077
17211
  const counts = {};
17078
17212
  for (const categoryDoc of categoriesSnapshot.docs) {
17079
17213
  const categoryId = categoryDoc.id;
17080
17214
  const subcategoriesRef = this.getSubcategoriesRef(categoryId);
17081
- const q = query33(subcategoriesRef, where33("isActive", "==", active));
17215
+ const q = query34(subcategoriesRef, where34("isActive", "==", active));
17082
17216
  const snapshot = await getCountFromServer4(q);
17083
17217
  counts[categoryId] = snapshot.data().count;
17084
17218
  }
@@ -17093,13 +17227,13 @@ var SubcategoryService = class extends BaseService {
17093
17227
  async getAllByCategoryId(categoryId, options = {}) {
17094
17228
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17095
17229
  const constraints = [
17096
- where33("isActive", "==", active),
17097
- orderBy20("name"),
17098
- queryLimit ? limit18(queryLimit) : void 0,
17099
- lastVisible ? startAfter16(lastVisible) : void 0
17230
+ where34("isActive", "==", active),
17231
+ orderBy21("name"),
17232
+ queryLimit ? limit19(queryLimit) : void 0,
17233
+ lastVisible ? startAfter17(lastVisible) : void 0
17100
17234
  ].filter((c) => !!c);
17101
- const q = query33(this.getSubcategoriesRef(categoryId), ...constraints);
17102
- const querySnapshot = await getDocs33(q);
17235
+ const q = query34(this.getSubcategoriesRef(categoryId), ...constraints);
17236
+ const querySnapshot = await getDocs34(q);
17103
17237
  const subcategories = querySnapshot.docs.map(
17104
17238
  (doc38) => ({
17105
17239
  id: doc38.id,
@@ -17120,16 +17254,16 @@ var SubcategoryService = class extends BaseService {
17120
17254
  async getAll(options = {}) {
17121
17255
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17122
17256
  const constraints = [
17123
- where33("isActive", "==", active),
17124
- orderBy20("name"),
17125
- queryLimit ? limit18(queryLimit) : void 0,
17126
- lastVisible ? startAfter16(lastVisible) : void 0
17257
+ where34("isActive", "==", active),
17258
+ orderBy21("name"),
17259
+ queryLimit ? limit19(queryLimit) : void 0,
17260
+ lastVisible ? startAfter17(lastVisible) : void 0
17127
17261
  ].filter((c) => !!c);
17128
- const q = query33(
17262
+ const q = query34(
17129
17263
  collectionGroup2(this.db, SUBCATEGORIES_COLLECTION),
17130
17264
  ...constraints
17131
17265
  );
17132
- const querySnapshot = await getDocs33(q);
17266
+ const querySnapshot = await getDocs34(q);
17133
17267
  const subcategories = querySnapshot.docs.map(
17134
17268
  (doc38) => ({
17135
17269
  id: doc38.id,
@@ -17145,11 +17279,11 @@ var SubcategoryService = class extends BaseService {
17145
17279
  * @returns Lista svih aktivnih subkategorija
17146
17280
  */
17147
17281
  async getAllForFilterByCategoryId(categoryId) {
17148
- const q = query33(
17282
+ const q = query34(
17149
17283
  this.getSubcategoriesRef(categoryId),
17150
- where33("isActive", "==", true)
17284
+ where34("isActive", "==", true)
17151
17285
  );
17152
- const querySnapshot = await getDocs33(q);
17286
+ const querySnapshot = await getDocs34(q);
17153
17287
  return querySnapshot.docs.map(
17154
17288
  (doc38) => ({
17155
17289
  id: doc38.id,
@@ -17162,11 +17296,11 @@ var SubcategoryService = class extends BaseService {
17162
17296
  * @returns Lista svih aktivnih subkategorija
17163
17297
  */
17164
17298
  async getAllForFilter() {
17165
- const q = query33(
17299
+ const q = query34(
17166
17300
  collectionGroup2(this.db, SUBCATEGORIES_COLLECTION),
17167
- where33("isActive", "==", true)
17301
+ where34("isActive", "==", true)
17168
17302
  );
17169
- const querySnapshot = await getDocs33(q);
17303
+ const querySnapshot = await getDocs34(q);
17170
17304
  return querySnapshot.docs.map(
17171
17305
  (doc38) => ({
17172
17306
  id: doc38.id,
@@ -17255,16 +17389,16 @@ var SubcategoryService = class extends BaseService {
17255
17389
  // src/backoffice/services/technology.service.ts
17256
17390
  import {
17257
17391
  addDoc as addDoc6,
17258
- collection as collection34,
17392
+ collection as collection35,
17259
17393
  doc as doc35,
17260
17394
  getDoc as getDoc37,
17261
- getDocs as getDocs34,
17262
- limit as limit19,
17263
- orderBy as orderBy21,
17264
- query as query34,
17265
- startAfter as startAfter17,
17395
+ getDocs as getDocs35,
17396
+ limit as limit20,
17397
+ orderBy as orderBy22,
17398
+ query as query35,
17399
+ startAfter as startAfter18,
17266
17400
  updateDoc as updateDoc33,
17267
- where as where34,
17401
+ where as where35,
17268
17402
  arrayUnion as arrayUnion9,
17269
17403
  arrayRemove as arrayRemove8
17270
17404
  } from "firebase/firestore";
@@ -17277,7 +17411,7 @@ var TechnologyService = class extends BaseService {
17277
17411
  * Reference to the Firestore collection of technologies.
17278
17412
  */
17279
17413
  get technologiesRef() {
17280
- return collection34(this.db, TECHNOLOGIES_COLLECTION);
17414
+ return collection35(this.db, TECHNOLOGIES_COLLECTION);
17281
17415
  }
17282
17416
  /**
17283
17417
  * Creates a new technology.
@@ -17314,8 +17448,8 @@ var TechnologyService = class extends BaseService {
17314
17448
  * @returns A record mapping subcategory ID to technology count.
17315
17449
  */
17316
17450
  async getTechnologyCounts(active = true) {
17317
- const q = query34(this.technologiesRef, where34("isActive", "==", active));
17318
- const snapshot = await getDocs34(q);
17451
+ const q = query35(this.technologiesRef, where35("isActive", "==", active));
17452
+ const snapshot = await getDocs35(q);
17319
17453
  const counts = {};
17320
17454
  snapshot.docs.forEach((doc38) => {
17321
17455
  const tech = doc38.data();
@@ -17329,8 +17463,8 @@ var TechnologyService = class extends BaseService {
17329
17463
  * @returns A record mapping category ID to technology count.
17330
17464
  */
17331
17465
  async getTechnologyCountsByCategory(active = true) {
17332
- const q = query34(this.technologiesRef, where34("isActive", "==", active));
17333
- const snapshot = await getDocs34(q);
17466
+ const q = query35(this.technologiesRef, where35("isActive", "==", active));
17467
+ const snapshot = await getDocs35(q);
17334
17468
  const counts = {};
17335
17469
  snapshot.docs.forEach((doc38) => {
17336
17470
  const tech = doc38.data();
@@ -17346,13 +17480,13 @@ var TechnologyService = class extends BaseService {
17346
17480
  async getAll(options = {}) {
17347
17481
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17348
17482
  const constraints = [
17349
- where34("isActive", "==", active),
17350
- orderBy21("name"),
17351
- queryLimit ? limit19(queryLimit) : void 0,
17352
- lastVisible ? startAfter17(lastVisible) : void 0
17483
+ where35("isActive", "==", active),
17484
+ orderBy22("name"),
17485
+ queryLimit ? limit20(queryLimit) : void 0,
17486
+ lastVisible ? startAfter18(lastVisible) : void 0
17353
17487
  ].filter((c) => !!c);
17354
- const q = query34(this.technologiesRef, ...constraints);
17355
- const snapshot = await getDocs34(q);
17488
+ const q = query35(this.technologiesRef, ...constraints);
17489
+ const snapshot = await getDocs35(q);
17356
17490
  const technologies = snapshot.docs.map(
17357
17491
  (doc38) => ({
17358
17492
  id: doc38.id,
@@ -17371,14 +17505,14 @@ var TechnologyService = class extends BaseService {
17371
17505
  async getAllByCategoryId(categoryId, options = {}) {
17372
17506
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17373
17507
  const constraints = [
17374
- where34("categoryId", "==", categoryId),
17375
- where34("isActive", "==", active),
17376
- orderBy21("name"),
17377
- queryLimit ? limit19(queryLimit) : void 0,
17378
- lastVisible ? startAfter17(lastVisible) : void 0
17508
+ where35("categoryId", "==", categoryId),
17509
+ where35("isActive", "==", active),
17510
+ orderBy22("name"),
17511
+ queryLimit ? limit20(queryLimit) : void 0,
17512
+ lastVisible ? startAfter18(lastVisible) : void 0
17379
17513
  ].filter((c) => !!c);
17380
- const q = query34(this.technologiesRef, ...constraints);
17381
- const snapshot = await getDocs34(q);
17514
+ const q = query35(this.technologiesRef, ...constraints);
17515
+ const snapshot = await getDocs35(q);
17382
17516
  const technologies = snapshot.docs.map(
17383
17517
  (doc38) => ({
17384
17518
  id: doc38.id,
@@ -17397,14 +17531,14 @@ var TechnologyService = class extends BaseService {
17397
17531
  async getAllBySubcategoryId(subcategoryId, options = {}) {
17398
17532
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17399
17533
  const constraints = [
17400
- where34("subcategoryId", "==", subcategoryId),
17401
- where34("isActive", "==", active),
17402
- orderBy21("name"),
17403
- queryLimit ? limit19(queryLimit) : void 0,
17404
- lastVisible ? startAfter17(lastVisible) : void 0
17534
+ where35("subcategoryId", "==", subcategoryId),
17535
+ where35("isActive", "==", active),
17536
+ orderBy22("name"),
17537
+ queryLimit ? limit20(queryLimit) : void 0,
17538
+ lastVisible ? startAfter18(lastVisible) : void 0
17405
17539
  ].filter((c) => !!c);
17406
- const q = query34(this.technologiesRef, ...constraints);
17407
- const snapshot = await getDocs34(q);
17540
+ const q = query35(this.technologiesRef, ...constraints);
17541
+ const snapshot = await getDocs35(q);
17408
17542
  const technologies = snapshot.docs.map(
17409
17543
  (doc38) => ({
17410
17544
  id: doc38.id,
@@ -17813,13 +17947,13 @@ var TechnologyService = class extends BaseService {
17813
17947
  * @param subcategoryId - The ID of the subcategory.
17814
17948
  */
17815
17949
  async getAllForFilterBySubcategory(subcategoryId) {
17816
- const q = query34(
17817
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17818
- where34("isActive", "==", true),
17819
- where34("subcategoryId", "==", subcategoryId),
17820
- orderBy21("name")
17950
+ const q = query35(
17951
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
17952
+ where35("isActive", "==", true),
17953
+ where35("subcategoryId", "==", subcategoryId),
17954
+ orderBy22("name")
17821
17955
  );
17822
- const snapshot = await getDocs34(q);
17956
+ const snapshot = await getDocs35(q);
17823
17957
  return snapshot.docs.map(
17824
17958
  (doc38) => ({
17825
17959
  id: doc38.id,
@@ -17833,14 +17967,14 @@ var TechnologyService = class extends BaseService {
17833
17967
  * @param subcategoryId - The ID of the subcategory.
17834
17968
  */
17835
17969
  async getAllForFilterBySubcategoryId(categoryId, subcategoryId) {
17836
- const q = query34(
17837
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17838
- where34("isActive", "==", true),
17839
- where34("categoryId", "==", categoryId),
17840
- where34("subcategoryId", "==", subcategoryId),
17841
- orderBy21("name")
17970
+ const q = query35(
17971
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
17972
+ where35("isActive", "==", true),
17973
+ where35("categoryId", "==", categoryId),
17974
+ where35("subcategoryId", "==", subcategoryId),
17975
+ orderBy22("name")
17842
17976
  );
17843
- const snapshot = await getDocs34(q);
17977
+ const snapshot = await getDocs35(q);
17844
17978
  return snapshot.docs.map(
17845
17979
  (doc38) => ({
17846
17980
  id: doc38.id,
@@ -17852,12 +17986,12 @@ var TechnologyService = class extends BaseService {
17852
17986
  * Gets all active technologies for filter dropdowns.
17853
17987
  */
17854
17988
  async getAllForFilter() {
17855
- const q = query34(
17856
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17857
- where34("isActive", "==", true),
17858
- orderBy21("name")
17989
+ const q = query35(
17990
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
17991
+ where35("isActive", "==", true),
17992
+ orderBy22("name")
17859
17993
  );
17860
- const snapshot = await getDocs34(q);
17994
+ const snapshot = await getDocs35(q);
17861
17995
  return snapshot.docs.map(
17862
17996
  (doc38) => ({
17863
17997
  id: doc38.id,
@@ -17870,17 +18004,17 @@ var TechnologyService = class extends BaseService {
17870
18004
  // src/backoffice/services/product.service.ts
17871
18005
  import {
17872
18006
  addDoc as addDoc7,
17873
- collection as collection35,
18007
+ collection as collection36,
17874
18008
  collectionGroup as collectionGroup3,
17875
18009
  doc as doc36,
17876
18010
  getDoc as getDoc38,
17877
- getDocs as getDocs35,
17878
- query as query35,
18011
+ getDocs as getDocs36,
18012
+ query as query36,
17879
18013
  updateDoc as updateDoc34,
17880
- where as where35,
17881
- limit as limit20,
17882
- orderBy as orderBy22,
17883
- startAfter as startAfter18,
18014
+ where as where36,
18015
+ limit as limit21,
18016
+ orderBy as orderBy23,
18017
+ startAfter as startAfter19,
17884
18018
  getCountFromServer as getCountFromServer6
17885
18019
  } from "firebase/firestore";
17886
18020
 
@@ -17895,7 +18029,7 @@ var ProductService = class extends BaseService {
17895
18029
  * @returns Firestore collection reference
17896
18030
  */
17897
18031
  getProductsRef(technologyId) {
17898
- return collection35(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
18032
+ return collection36(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
17899
18033
  }
17900
18034
  /**
17901
18035
  * Creates a new product under technology
@@ -17919,22 +18053,22 @@ var ProductService = class extends BaseService {
17919
18053
  */
17920
18054
  async getAll(options) {
17921
18055
  const { rowsPerPage, lastVisible, categoryId, subcategoryId, technologyId } = options;
17922
- const constraints = [where35("isActive", "==", true), orderBy22("name")];
18056
+ const constraints = [where36("isActive", "==", true), orderBy23("name")];
17923
18057
  if (categoryId) {
17924
- constraints.push(where35("categoryId", "==", categoryId));
18058
+ constraints.push(where36("categoryId", "==", categoryId));
17925
18059
  }
17926
18060
  if (subcategoryId) {
17927
- constraints.push(where35("subcategoryId", "==", subcategoryId));
18061
+ constraints.push(where36("subcategoryId", "==", subcategoryId));
17928
18062
  }
17929
18063
  if (technologyId) {
17930
- constraints.push(where35("technologyId", "==", technologyId));
18064
+ constraints.push(where36("technologyId", "==", technologyId));
17931
18065
  }
17932
18066
  if (lastVisible) {
17933
- constraints.push(startAfter18(lastVisible));
18067
+ constraints.push(startAfter19(lastVisible));
17934
18068
  }
17935
- constraints.push(limit20(rowsPerPage));
17936
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
17937
- const snapshot = await getDocs35(q);
18069
+ constraints.push(limit21(rowsPerPage));
18070
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
18071
+ const snapshot = await getDocs36(q);
17938
18072
  const products = snapshot.docs.map(
17939
18073
  (doc38) => ({
17940
18074
  id: doc38.id,
@@ -17949,17 +18083,17 @@ var ProductService = class extends BaseService {
17949
18083
  */
17950
18084
  async getProductsCount(options) {
17951
18085
  const { categoryId, subcategoryId, technologyId } = options;
17952
- const constraints = [where35("isActive", "==", true)];
18086
+ const constraints = [where36("isActive", "==", true)];
17953
18087
  if (categoryId) {
17954
- constraints.push(where35("categoryId", "==", categoryId));
18088
+ constraints.push(where36("categoryId", "==", categoryId));
17955
18089
  }
17956
18090
  if (subcategoryId) {
17957
- constraints.push(where35("subcategoryId", "==", subcategoryId));
18091
+ constraints.push(where36("subcategoryId", "==", subcategoryId));
17958
18092
  }
17959
18093
  if (technologyId) {
17960
- constraints.push(where35("technologyId", "==", technologyId));
18094
+ constraints.push(where36("technologyId", "==", technologyId));
17961
18095
  }
17962
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
18096
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
17963
18097
  const snapshot = await getCountFromServer6(q);
17964
18098
  return snapshot.data().count;
17965
18099
  }
@@ -17968,8 +18102,8 @@ var ProductService = class extends BaseService {
17968
18102
  * This uses a single collectionGroup query for efficiency.
17969
18103
  */
17970
18104
  async getProductCounts() {
17971
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), where35("isActive", "==", true));
17972
- const snapshot = await getDocs35(q);
18105
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), where36("isActive", "==", true));
18106
+ const snapshot = await getDocs36(q);
17973
18107
  const counts = {
17974
18108
  byCategory: {},
17975
18109
  bySubcategory: {},
@@ -17997,12 +18131,12 @@ var ProductService = class extends BaseService {
17997
18131
  * Gets all products for a specific technology (non-paginated, for filters/dropdowns)
17998
18132
  */
17999
18133
  async getAllByTechnology(technologyId) {
18000
- const q = query35(
18134
+ const q = query36(
18001
18135
  this.getProductsRef(technologyId),
18002
- where35("isActive", "==", true),
18003
- orderBy22("name")
18136
+ where36("isActive", "==", true),
18137
+ orderBy23("name")
18004
18138
  );
18005
- const snapshot = await getDocs35(q);
18139
+ const snapshot = await getDocs36(q);
18006
18140
  return snapshot.docs.map(
18007
18141
  (doc38) => ({
18008
18142
  id: doc38.id,
@@ -18014,16 +18148,16 @@ var ProductService = class extends BaseService {
18014
18148
  * Gets all products for a brand by filtering through all technologies
18015
18149
  */
18016
18150
  async getAllByBrand(brandId) {
18017
- const allTechnologiesRef = collection35(this.db, TECHNOLOGIES_COLLECTION);
18018
- const technologiesSnapshot = await getDocs35(allTechnologiesRef);
18151
+ const allTechnologiesRef = collection36(this.db, TECHNOLOGIES_COLLECTION);
18152
+ const technologiesSnapshot = await getDocs36(allTechnologiesRef);
18019
18153
  const products = [];
18020
18154
  for (const techDoc of technologiesSnapshot.docs) {
18021
- const q = query35(
18155
+ const q = query36(
18022
18156
  this.getProductsRef(techDoc.id),
18023
- where35("brandId", "==", brandId),
18024
- where35("isActive", "==", true)
18157
+ where36("brandId", "==", brandId),
18158
+ where36("isActive", "==", true)
18025
18159
  );
18026
- const snapshot = await getDocs35(q);
18160
+ const snapshot = await getDocs36(q);
18027
18161
  products.push(
18028
18162
  ...snapshot.docs.map(
18029
18163
  (doc38) => ({
@@ -18119,9 +18253,9 @@ var ConstantsService = class extends BaseService {
18119
18253
  */
18120
18254
  async getAllBenefits(options) {
18121
18255
  const allBenefits = await this.getAllBenefitsForFilter();
18122
- const { page, limit: limit21 } = options;
18123
- const startIndex = page * limit21;
18124
- const endIndex = startIndex + limit21;
18256
+ const { page, limit: limit22 } = options;
18257
+ const startIndex = page * limit22;
18258
+ const endIndex = startIndex + limit22;
18125
18259
  const paginatedBenefits = allBenefits.slice(startIndex, endIndex);
18126
18260
  return { benefits: paginatedBenefits, total: allBenefits.length };
18127
18261
  }
@@ -18218,9 +18352,9 @@ var ConstantsService = class extends BaseService {
18218
18352
  */
18219
18353
  async getAllContraindications(options) {
18220
18354
  const allContraindications = await this.getAllContraindicationsForFilter();
18221
- const { page, limit: limit21 } = options;
18222
- const startIndex = page * limit21;
18223
- const endIndex = startIndex + limit21;
18355
+ const { page, limit: limit22 } = options;
18356
+ const startIndex = page * limit22;
18357
+ const endIndex = startIndex + limit22;
18224
18358
  const paginatedContraindications = allContraindications.slice(
18225
18359
  startIndex,
18226
18360
  endIndex
@@ -18365,6 +18499,7 @@ export {
18365
18499
  AuthService,
18366
18500
  BaseService,
18367
18501
  BillingTransactionType,
18502
+ BillingTransactionsService,
18368
18503
  BlockingCondition,
18369
18504
  BrandService,
18370
18505
  CALENDAR_COLLECTION,