@blackcode_sa/metaestetics-api 1.8.5 → 1.8.6

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
@@ -981,7 +981,7 @@ async function searchAppointmentsUtil(db, params) {
981
981
  const q = query(collection(db, APPOINTMENTS_COLLECTION), ...constraints);
982
982
  const querySnapshot = await getDocs(q);
983
983
  const appointments = querySnapshot.docs.map(
984
- (doc38) => doc38.data()
984
+ (doc37) => doc37.data()
985
985
  );
986
986
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
987
987
  return { appointments, lastDoc };
@@ -1788,7 +1788,7 @@ var AppointmentService = class extends BaseService {
1788
1788
  );
1789
1789
  const querySnapshot = await getDocs2(q);
1790
1790
  const appointments = querySnapshot.docs.map(
1791
- (doc38) => doc38.data()
1791
+ (doc37) => doc37.data()
1792
1792
  );
1793
1793
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
1794
1794
  console.log(
@@ -1861,7 +1861,7 @@ var AppointmentService = class extends BaseService {
1861
1861
  );
1862
1862
  const querySnapshot = await getDocs2(q);
1863
1863
  const appointments = querySnapshot.docs.map(
1864
- (doc38) => doc38.data()
1864
+ (doc37) => doc37.data()
1865
1865
  );
1866
1866
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
1867
1867
  console.log(
@@ -3170,7 +3170,7 @@ var MediaService = class extends BaseService {
3170
3170
  try {
3171
3171
  const querySnapshot = await getDocs3(finalQuery);
3172
3172
  const mediaList = querySnapshot.docs.map(
3173
- (doc38) => doc38.data()
3173
+ (doc37) => doc37.data()
3174
3174
  );
3175
3175
  console.log(`[MediaService] Found ${mediaList.length} media items.`);
3176
3176
  return mediaList;
@@ -3233,8 +3233,8 @@ var getPatientsByClinicUtil = async (db, clinicId, options) => {
3233
3233
  }
3234
3234
  const patientsSnapshot = await getDocs4(q);
3235
3235
  const patients = [];
3236
- patientsSnapshot.forEach((doc38) => {
3237
- patients.push(doc38.data());
3236
+ patientsSnapshot.forEach((doc37) => {
3237
+ patients.push(doc37.data());
3238
3238
  });
3239
3239
  console.log(
3240
3240
  `[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
@@ -3608,8 +3608,8 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
3608
3608
  }
3609
3609
  const patientsSnapshot = await getDocs5(q);
3610
3610
  const patients = [];
3611
- patientsSnapshot.forEach((doc38) => {
3612
- patients.push(doc38.data());
3611
+ patientsSnapshot.forEach((doc37) => {
3612
+ patients.push(doc37.data());
3613
3613
  });
3614
3614
  console.log(
3615
3615
  `[getPatientsByPractitionerUtil] Found ${patients.length} patients for practitioner ID: ${practitionerId}`
@@ -4189,7 +4189,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
4189
4189
  where6("clinicGroupId", "==", clinicGroupId)
4190
4190
  );
4191
4191
  const querySnapshot = await getDocs6(q);
4192
- return querySnapshot.docs.map((doc38) => doc38.data());
4192
+ return querySnapshot.docs.map((doc37) => doc37.data());
4193
4193
  }
4194
4194
  async function updateClinicAdmin(db, adminId, data) {
4195
4195
  const admin2 = await getClinicAdmin(db, adminId);
@@ -4870,9 +4870,9 @@ var updateAllergyUtil = async (db, patientId, data, requesterId, requesterRoles)
4870
4870
  };
4871
4871
  var removeAllergyUtil = async (db, patientId, allergyIndex, requesterId, requesterRoles) => {
4872
4872
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4873
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4874
- if (!doc38.exists()) throw new Error("Medical info not found");
4875
- const medicalInfo = doc38.data();
4873
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4874
+ if (!doc37.exists()) throw new Error("Medical info not found");
4875
+ const medicalInfo = doc37.data();
4876
4876
  if (allergyIndex >= medicalInfo.allergies.length) {
4877
4877
  throw new Error("Invalid allergy index");
4878
4878
  }
@@ -4899,9 +4899,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
4899
4899
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4900
4900
  const validatedData = updateBlockingConditionSchema.parse(data);
4901
4901
  const { conditionIndex, ...updateData } = validatedData;
4902
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4903
- if (!doc38.exists()) throw new Error("Medical info not found");
4904
- const medicalInfo = doc38.data();
4902
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4903
+ if (!doc37.exists()) throw new Error("Medical info not found");
4904
+ const medicalInfo = doc37.data();
4905
4905
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
4906
4906
  throw new Error("Invalid blocking condition index");
4907
4907
  }
@@ -4918,9 +4918,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, requesterId, reque
4918
4918
  };
4919
4919
  var removeBlockingConditionUtil = async (db, patientId, conditionIndex, requesterId, requesterRoles) => {
4920
4920
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4921
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4922
- if (!doc38.exists()) throw new Error("Medical info not found");
4923
- const medicalInfo = doc38.data();
4921
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4922
+ if (!doc37.exists()) throw new Error("Medical info not found");
4923
+ const medicalInfo = doc37.data();
4924
4924
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
4925
4925
  throw new Error("Invalid blocking condition index");
4926
4926
  }
@@ -4947,9 +4947,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
4947
4947
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4948
4948
  const validatedData = updateContraindicationSchema.parse(data);
4949
4949
  const { contraindicationIndex, ...updateData } = validatedData;
4950
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4951
- if (!doc38.exists()) throw new Error("Medical info not found");
4952
- const medicalInfo = doc38.data();
4950
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4951
+ if (!doc37.exists()) throw new Error("Medical info not found");
4952
+ const medicalInfo = doc37.data();
4953
4953
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
4954
4954
  throw new Error("Invalid contraindication index");
4955
4955
  }
@@ -4966,9 +4966,9 @@ var updateContraindicationUtil = async (db, patientId, data, requesterId, reques
4966
4966
  };
4967
4967
  var removeContraindicationUtil = async (db, patientId, contraindicationIndex, requesterId, requesterRoles) => {
4968
4968
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4969
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4970
- if (!doc38.exists()) throw new Error("Medical info not found");
4971
- const medicalInfo = doc38.data();
4969
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4970
+ if (!doc37.exists()) throw new Error("Medical info not found");
4971
+ const medicalInfo = doc37.data();
4972
4972
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
4973
4973
  throw new Error("Invalid contraindication index");
4974
4974
  }
@@ -4995,9 +4995,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
4995
4995
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
4996
4996
  const validatedData = updateMedicationSchema.parse(data);
4997
4997
  const { medicationIndex, ...updateData } = validatedData;
4998
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4999
- if (!doc38.exists()) throw new Error("Medical info not found");
5000
- const medicalInfo = doc38.data();
4998
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
4999
+ if (!doc37.exists()) throw new Error("Medical info not found");
5000
+ const medicalInfo = doc37.data();
5001
5001
  if (medicationIndex >= medicalInfo.currentMedications.length) {
5002
5002
  throw new Error("Invalid medication index");
5003
5003
  }
@@ -5014,9 +5014,9 @@ var updateMedicationUtil = async (db, patientId, data, requesterId, requesterRol
5014
5014
  };
5015
5015
  var removeMedicationUtil = async (db, patientId, medicationIndex, requesterId, requesterRoles) => {
5016
5016
  await checkMedicalAccessUtil(db, patientId, requesterId, requesterRoles);
5017
- const doc38 = await getDoc10(getMedicalInfoDocRef(db, patientId));
5018
- if (!doc38.exists()) throw new Error("Medical info not found");
5019
- const medicalInfo = doc38.data();
5017
+ const doc37 = await getDoc10(getMedicalInfoDocRef(db, patientId));
5018
+ if (!doc37.exists()) throw new Error("Medical info not found");
5019
+ const medicalInfo = doc37.data();
5020
5020
  if (medicationIndex >= medicalInfo.currentMedications.length) {
5021
5021
  throw new Error("Invalid medication index");
5022
5022
  }
@@ -5319,7 +5319,7 @@ var searchPatientsUtil = async (db, params, requester) => {
5319
5319
  const finalQuery = query8(patientsCollectionRef, ...constraints);
5320
5320
  const querySnapshot = await getDocs8(finalQuery);
5321
5321
  const patients = querySnapshot.docs.map(
5322
- (doc38) => doc38.data()
5322
+ (doc37) => doc37.data()
5323
5323
  );
5324
5324
  console.log(
5325
5325
  `[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
@@ -5351,8 +5351,8 @@ var getAllPatientsUtil = async (db, options) => {
5351
5351
  }
5352
5352
  const patientsSnapshot = await getDocs8(q);
5353
5353
  const patients = [];
5354
- patientsSnapshot.forEach((doc38) => {
5355
- patients.push(doc38.data());
5354
+ patientsSnapshot.forEach((doc37) => {
5355
+ patients.push(doc37.data());
5356
5356
  });
5357
5357
  console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
5358
5358
  return patients;
@@ -5485,7 +5485,7 @@ var getActiveInviteTokensByClinicUtil = async (db, clinicId) => {
5485
5485
  if (querySnapshot.empty) {
5486
5486
  return [];
5487
5487
  }
5488
- return querySnapshot.docs.map((doc38) => doc38.data());
5488
+ return querySnapshot.docs.map((doc37) => doc37.data());
5489
5489
  };
5490
5490
  var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
5491
5491
  const tokensRef = collection9(
@@ -5503,7 +5503,7 @@ var getActiveInviteTokensByPatientUtil = async (db, patientId) => {
5503
5503
  if (querySnapshot.empty) {
5504
5504
  return [];
5505
5505
  }
5506
- return querySnapshot.docs.map((doc38) => doc38.data());
5506
+ return querySnapshot.docs.map((doc37) => doc37.data());
5507
5507
  };
5508
5508
 
5509
5509
  // src/services/patient/patient.service.ts
@@ -6626,7 +6626,7 @@ var PractitionerService = class extends BaseService {
6626
6626
  where10("expiresAt", ">", Timestamp14.now())
6627
6627
  );
6628
6628
  const querySnapshot = await getDocs10(q);
6629
- return querySnapshot.docs.map((doc38) => doc38.data());
6629
+ return querySnapshot.docs.map((doc37) => doc37.data());
6630
6630
  }
6631
6631
  /**
6632
6632
  * Gets a token by its string value and validates it
@@ -6736,7 +6736,7 @@ var PractitionerService = class extends BaseService {
6736
6736
  where10("status", "==", "active" /* ACTIVE */)
6737
6737
  );
6738
6738
  const querySnapshot = await getDocs10(q);
6739
- return querySnapshot.docs.map((doc38) => doc38.data());
6739
+ return querySnapshot.docs.map((doc37) => doc37.data());
6740
6740
  }
6741
6741
  /**
6742
6742
  * Dohvata sve zdravstvene radnike za određenu kliniku
@@ -6748,7 +6748,7 @@ var PractitionerService = class extends BaseService {
6748
6748
  where10("isActive", "==", true)
6749
6749
  );
6750
6750
  const querySnapshot = await getDocs10(q);
6751
- return querySnapshot.docs.map((doc38) => doc38.data());
6751
+ return querySnapshot.docs.map((doc37) => doc37.data());
6752
6752
  }
6753
6753
  /**
6754
6754
  * Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
@@ -6760,7 +6760,7 @@ var PractitionerService = class extends BaseService {
6760
6760
  where10("status", "==", "draft" /* DRAFT */)
6761
6761
  );
6762
6762
  const querySnapshot = await getDocs10(q);
6763
- return querySnapshot.docs.map((doc38) => doc38.data());
6763
+ return querySnapshot.docs.map((doc37) => doc37.data());
6764
6764
  }
6765
6765
  /**
6766
6766
  * Updates a practitioner
@@ -6974,7 +6974,7 @@ var PractitionerService = class extends BaseService {
6974
6974
  );
6975
6975
  const querySnapshot = await getDocs10(q);
6976
6976
  const practitioners = querySnapshot.docs.map(
6977
- (doc38) => doc38.data()
6977
+ (doc37) => doc37.data()
6978
6978
  );
6979
6979
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
6980
6980
  return {
@@ -7045,8 +7045,8 @@ var PractitionerService = class extends BaseService {
7045
7045
  console.log(
7046
7046
  `[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
7047
7047
  );
7048
- let practitioners = querySnapshot.docs.map((doc38) => {
7049
- return { ...doc38.data(), id: doc38.id };
7048
+ let practitioners = querySnapshot.docs.map((doc37) => {
7049
+ return { ...doc37.data(), id: doc37.id };
7050
7050
  });
7051
7051
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
7052
7052
  if (filters.nameSearch && filters.nameSearch.trim() !== "") {
@@ -7530,7 +7530,7 @@ var UserService = class extends BaseService {
7530
7530
  ];
7531
7531
  const q = query11(collection11(this.db, USERS_COLLECTION), ...constraints);
7532
7532
  const querySnapshot = await getDocs11(q);
7533
- const users = querySnapshot.docs.map((doc38) => doc38.data());
7533
+ const users = querySnapshot.docs.map((doc37) => doc37.data());
7534
7534
  return users.map((userData) => userSchema.parse(userData));
7535
7535
  }
7536
7536
  /**
@@ -7910,7 +7910,7 @@ async function getAllActiveGroups(db) {
7910
7910
  where12("isActive", "==", true)
7911
7911
  );
7912
7912
  const querySnapshot = await getDocs12(q);
7913
- return querySnapshot.docs.map((doc38) => doc38.data());
7913
+ return querySnapshot.docs.map((doc37) => doc37.data());
7914
7914
  }
7915
7915
  async function updateClinicGroup(db, groupId, data, app) {
7916
7916
  console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
@@ -8375,7 +8375,7 @@ async function getClinicsByGroup(db, groupId) {
8375
8375
  where13("isActive", "==", true)
8376
8376
  );
8377
8377
  const querySnapshot = await getDocs13(q);
8378
- return querySnapshot.docs.map((doc38) => doc38.data());
8378
+ return querySnapshot.docs.map((doc37) => doc37.data());
8379
8379
  }
8380
8380
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
8381
8381
  console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
@@ -8569,7 +8569,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
8569
8569
  }
8570
8570
  const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8571
8571
  const querySnapshot = await getDocs13(q);
8572
- return querySnapshot.docs.map((doc38) => doc38.data());
8572
+ return querySnapshot.docs.map((doc37) => doc37.data());
8573
8573
  }
8574
8574
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
8575
8575
  return getClinicsByAdmin(
@@ -8614,11 +8614,11 @@ async function getAllClinics(db, pagination, lastDoc) {
8614
8614
  }
8615
8615
  const clinicsSnapshot = await getDocs13(clinicsQuery);
8616
8616
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
8617
- const clinics = clinicsSnapshot.docs.map((doc38) => {
8618
- const data = doc38.data();
8617
+ const clinics = clinicsSnapshot.docs.map((doc37) => {
8618
+ const data = doc37.data();
8619
8619
  return {
8620
8620
  ...data,
8621
- id: doc38.id
8621
+ id: doc37.id
8622
8622
  };
8623
8623
  });
8624
8624
  return {
@@ -8645,8 +8645,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
8645
8645
  ];
8646
8646
  const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8647
8647
  const querySnapshot = await getDocs13(q);
8648
- for (const doc38 of querySnapshot.docs) {
8649
- const clinic = doc38.data();
8648
+ for (const doc37 of querySnapshot.docs) {
8649
+ const clinic = doc37.data();
8650
8650
  const distance = distanceBetween2(
8651
8651
  [center.latitude, center.longitude],
8652
8652
  [clinic.location.latitude, clinic.location.longitude]
@@ -8768,8 +8768,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
8768
8768
  }
8769
8769
  const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8770
8770
  const querySnapshot = await getDocs14(q);
8771
- for (const doc38 of querySnapshot.docs) {
8772
- const clinic = doc38.data();
8771
+ for (const doc37 of querySnapshot.docs) {
8772
+ const clinic = doc37.data();
8773
8773
  const distance = distanceBetween3(
8774
8774
  [center.latitude, center.longitude],
8775
8775
  [clinic.location.latitude, clinic.location.longitude]
@@ -8865,8 +8865,8 @@ async function getClinicsByFilters(db, filters) {
8865
8865
  console.log(
8866
8866
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
8867
8867
  );
8868
- for (const doc38 of querySnapshot.docs) {
8869
- const clinic = { ...doc38.data(), id: doc38.id };
8868
+ for (const doc37 of querySnapshot.docs) {
8869
+ const clinic = { ...doc37.data(), id: doc37.id };
8870
8870
  const distance = distanceBetween4(
8871
8871
  [center.latitude, center.longitude],
8872
8872
  [clinic.location.latitude, clinic.location.longitude]
@@ -8922,8 +8922,8 @@ async function getClinicsByFilters(db, filters) {
8922
8922
  console.log(
8923
8923
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
8924
8924
  );
8925
- const clinics = querySnapshot.docs.map((doc38) => {
8926
- return { ...doc38.data(), id: doc38.id };
8925
+ const clinics = querySnapshot.docs.map((doc37) => {
8926
+ return { ...doc37.data(), id: doc37.id };
8927
8927
  });
8928
8928
  let filteredClinics = clinics;
8929
8929
  if (filters.center) {
@@ -10603,7 +10603,7 @@ async function searchCalendarEventsUtil(db, params) {
10603
10603
  const finalQuery = query21(collectionRef, ...constraints);
10604
10604
  const querySnapshot = await getDocs21(finalQuery);
10605
10605
  const events = querySnapshot.docs.map(
10606
- (doc38) => ({ id: doc38.id, ...doc38.data() })
10606
+ (doc37) => ({ id: doc37.id, ...doc37.data() })
10607
10607
  );
10608
10608
  return events;
10609
10609
  } catch (error) {
@@ -10696,7 +10696,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
10696
10696
  );
10697
10697
  const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
10698
10698
  const querySnapshot = await getDocs22(q);
10699
- return querySnapshot.docs.map((doc38) => doc38.data());
10699
+ return querySnapshot.docs.map((doc37) => doc37.data());
10700
10700
  }
10701
10701
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
10702
10702
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
@@ -10713,7 +10713,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
10713
10713
  );
10714
10714
  const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
10715
10715
  const querySnapshot = await getDocs22(q);
10716
- return querySnapshot.docs.map((doc38) => doc38.data());
10716
+ return querySnapshot.docs.map((doc37) => doc37.data());
10717
10717
  }
10718
10718
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
10719
10719
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
@@ -10730,7 +10730,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
10730
10730
  );
10731
10731
  const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
10732
10732
  const querySnapshot = await getDocs22(q);
10733
- return querySnapshot.docs.map((doc38) => doc38.data());
10733
+ return querySnapshot.docs.map((doc37) => doc37.data());
10734
10734
  }
10735
10735
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
10736
10736
  const calendarRef = getPractitionerSyncedCalendarDocRef(
@@ -12085,9 +12085,9 @@ var CalendarServiceV2 = class extends BaseService {
12085
12085
  where23("eventTime.start", "<=", Timestamp26.fromDate(endDate))
12086
12086
  );
12087
12087
  const eventsSnapshot = await getDocs23(q);
12088
- const events = eventsSnapshot.docs.map((doc38) => ({
12089
- id: doc38.id,
12090
- ...doc38.data()
12088
+ const events = eventsSnapshot.docs.map((doc37) => ({
12089
+ id: doc37.id,
12090
+ ...doc37.data()
12091
12091
  }));
12092
12092
  const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
12093
12093
  doctorId
@@ -12721,7 +12721,7 @@ var CalendarServiceV2 = class extends BaseService {
12721
12721
  ])
12722
12722
  );
12723
12723
  const querySnapshot = await getDocs23(q);
12724
- return querySnapshot.docs.map((doc38) => doc38.data());
12724
+ return querySnapshot.docs.map((doc37) => doc37.data());
12725
12725
  }
12726
12726
  /**
12727
12727
  * Calculates available time slots based on working hours, schedule and existing appointments
@@ -13266,7 +13266,7 @@ var PractitionerInviteService = class extends BaseService {
13266
13266
  ...constraints
13267
13267
  );
13268
13268
  const querySnapshot = await getDocs24(q);
13269
- return querySnapshot.docs.map((doc38) => doc38.data());
13269
+ return querySnapshot.docs.map((doc37) => doc37.data());
13270
13270
  } catch (error) {
13271
13271
  console.error(
13272
13272
  "[PractitionerInviteService] Error getting doctor invites:",
@@ -13295,7 +13295,7 @@ var PractitionerInviteService = class extends BaseService {
13295
13295
  ...constraints
13296
13296
  );
13297
13297
  const querySnapshot = await getDocs24(q);
13298
- return querySnapshot.docs.map((doc38) => doc38.data());
13298
+ return querySnapshot.docs.map((doc37) => doc37.data());
13299
13299
  } catch (error) {
13300
13300
  console.error(
13301
13301
  "[PractitionerInviteService] Error getting clinic invites:",
@@ -13451,7 +13451,7 @@ var PractitionerInviteService = class extends BaseService {
13451
13451
  );
13452
13452
  const querySnapshot = await getDocs24(q);
13453
13453
  let invites = querySnapshot.docs.map(
13454
- (doc38) => doc38.data()
13454
+ (doc37) => doc37.data()
13455
13455
  );
13456
13456
  if (filters.fromDate) {
13457
13457
  invites = invites.filter(
@@ -13721,8 +13721,8 @@ var DocumentationTemplateService = class extends BaseService {
13721
13721
  const q = query25(versionsCollectionRef, orderBy13("version", "desc"));
13722
13722
  const querySnapshot = await getDocs25(q);
13723
13723
  const versions = [];
13724
- querySnapshot.forEach((doc38) => {
13725
- versions.push(doc38.data());
13724
+ querySnapshot.forEach((doc37) => {
13725
+ versions.push(doc37.data());
13726
13726
  });
13727
13727
  return versions;
13728
13728
  }
@@ -13753,9 +13753,9 @@ var DocumentationTemplateService = class extends BaseService {
13753
13753
  const querySnapshot = await getDocs25(q);
13754
13754
  const templates = [];
13755
13755
  let lastVisible = null;
13756
- querySnapshot.forEach((doc38) => {
13757
- templates.push(doc38.data());
13758
- lastVisible = doc38;
13756
+ querySnapshot.forEach((doc37) => {
13757
+ templates.push(doc37.data());
13758
+ lastVisible = doc37;
13759
13759
  });
13760
13760
  return {
13761
13761
  templates,
@@ -13783,9 +13783,9 @@ var DocumentationTemplateService = class extends BaseService {
13783
13783
  const querySnapshot = await getDocs25(q);
13784
13784
  const templates = [];
13785
13785
  let lastVisible = null;
13786
- querySnapshot.forEach((doc38) => {
13787
- templates.push(doc38.data());
13788
- lastVisible = doc38;
13786
+ querySnapshot.forEach((doc37) => {
13787
+ templates.push(doc37.data());
13788
+ lastVisible = doc37;
13789
13789
  });
13790
13790
  return {
13791
13791
  templates,
@@ -13812,9 +13812,9 @@ var DocumentationTemplateService = class extends BaseService {
13812
13812
  const querySnapshot = await getDocs25(q);
13813
13813
  const templates = [];
13814
13814
  let lastVisible = null;
13815
- querySnapshot.forEach((doc38) => {
13816
- templates.push(doc38.data());
13817
- lastVisible = doc38;
13815
+ querySnapshot.forEach((doc37) => {
13816
+ templates.push(doc37.data());
13817
+ lastVisible = doc37;
13818
13818
  });
13819
13819
  return {
13820
13820
  templates,
@@ -13840,8 +13840,8 @@ var DocumentationTemplateService = class extends BaseService {
13840
13840
  }
13841
13841
  const querySnapshot = await getDocs25(q);
13842
13842
  const templates = [];
13843
- querySnapshot.forEach((doc38) => {
13844
- templates.push(doc38.data());
13843
+ querySnapshot.forEach((doc37) => {
13844
+ templates.push(doc37.data());
13845
13845
  });
13846
13846
  return templates;
13847
13847
  }
@@ -14047,9 +14047,9 @@ var FilledDocumentService = class extends BaseService {
14047
14047
  const querySnapshot = await getDocs26(q);
14048
14048
  const documents = [];
14049
14049
  let lastVisible = null;
14050
- querySnapshot.forEach((doc38) => {
14051
- documents.push(doc38.data());
14052
- lastVisible = doc38;
14050
+ querySnapshot.forEach((doc37) => {
14051
+ documents.push(doc37.data());
14052
+ lastVisible = doc37;
14053
14053
  });
14054
14054
  return {
14055
14055
  documents,
@@ -14271,9 +14271,9 @@ var NotificationService = class extends BaseService {
14271
14271
  orderBy15("notificationTime", "desc")
14272
14272
  );
14273
14273
  const querySnapshot = await getDocs27(q);
14274
- return querySnapshot.docs.map((doc38) => ({
14275
- id: doc38.id,
14276
- ...doc38.data()
14274
+ return querySnapshot.docs.map((doc37) => ({
14275
+ id: doc37.id,
14276
+ ...doc37.data()
14277
14277
  }));
14278
14278
  }
14279
14279
  /**
@@ -14287,9 +14287,9 @@ var NotificationService = class extends BaseService {
14287
14287
  orderBy15("notificationTime", "desc")
14288
14288
  );
14289
14289
  const querySnapshot = await getDocs27(q);
14290
- return querySnapshot.docs.map((doc38) => ({
14291
- id: doc38.id,
14292
- ...doc38.data()
14290
+ return querySnapshot.docs.map((doc37) => ({
14291
+ id: doc37.id,
14292
+ ...doc37.data()
14293
14293
  }));
14294
14294
  }
14295
14295
  /**
@@ -14361,9 +14361,9 @@ var NotificationService = class extends BaseService {
14361
14361
  orderBy15("notificationTime", "desc")
14362
14362
  );
14363
14363
  const querySnapshot = await getDocs27(q);
14364
- return querySnapshot.docs.map((doc38) => ({
14365
- id: doc38.id,
14366
- ...doc38.data()
14364
+ return querySnapshot.docs.map((doc37) => ({
14365
+ id: doc37.id,
14366
+ ...doc37.data()
14367
14367
  }));
14368
14368
  }
14369
14369
  /**
@@ -14376,9 +14376,9 @@ var NotificationService = class extends BaseService {
14376
14376
  orderBy15("notificationTime", "desc")
14377
14377
  );
14378
14378
  const querySnapshot = await getDocs27(q);
14379
- return querySnapshot.docs.map((doc38) => ({
14380
- id: doc38.id,
14381
- ...doc38.data()
14379
+ return querySnapshot.docs.map((doc37) => ({
14380
+ id: doc37.id,
14381
+ ...doc37.data()
14382
14382
  }));
14383
14383
  }
14384
14384
  };
@@ -14883,8 +14883,8 @@ var ProcedureService = class extends BaseService {
14883
14883
  where29(documentId2(), "in", chunk)
14884
14884
  );
14885
14885
  const practitionersSnapshot = await getDocs29(practitionersQuery);
14886
- practitionersSnapshot.docs.forEach((doc38) => {
14887
- practitionersMap.set(doc38.id, doc38.data());
14886
+ practitionersSnapshot.docs.forEach((doc37) => {
14887
+ practitionersMap.set(doc37.id, doc37.data());
14888
14888
  });
14889
14889
  }
14890
14890
  if (practitionersMap.size !== practitionerIds.length) {
@@ -14966,8 +14966,8 @@ var ProcedureService = class extends BaseService {
14966
14966
  where29(documentId2(), "in", chunk)
14967
14967
  );
14968
14968
  const snapshot = await getDocs29(q);
14969
- snapshot.forEach((doc38) => {
14970
- fetchedProcedures.push(doc38.data());
14969
+ snapshot.forEach((doc37) => {
14970
+ fetchedProcedures.push(doc37.data());
14971
14971
  });
14972
14972
  }
14973
14973
  return fetchedProcedures;
@@ -14997,7 +14997,7 @@ var ProcedureService = class extends BaseService {
14997
14997
  where29("isActive", "==", true)
14998
14998
  );
14999
14999
  const snapshot = await getDocs29(q);
15000
- return snapshot.docs.map((doc38) => doc38.data());
15000
+ return snapshot.docs.map((doc37) => doc37.data());
15001
15001
  }
15002
15002
  /**
15003
15003
  * Gets all procedures for a practitioner
@@ -15011,7 +15011,7 @@ var ProcedureService = class extends BaseService {
15011
15011
  where29("isActive", "==", true)
15012
15012
  );
15013
15013
  const snapshot = await getDocs29(q);
15014
- return snapshot.docs.map((doc38) => doc38.data());
15014
+ return snapshot.docs.map((doc37) => doc37.data());
15015
15015
  }
15016
15016
  /**
15017
15017
  * Gets all inactive procedures for a practitioner
@@ -15025,7 +15025,7 @@ var ProcedureService = class extends BaseService {
15025
15025
  where29("isActive", "==", false)
15026
15026
  );
15027
15027
  const snapshot = await getDocs29(q);
15028
- return snapshot.docs.map((doc38) => doc38.data());
15028
+ return snapshot.docs.map((doc37) => doc37.data());
15029
15029
  }
15030
15030
  /**
15031
15031
  * Updates a procedure
@@ -15237,11 +15237,11 @@ var ProcedureService = class extends BaseService {
15237
15237
  }
15238
15238
  const proceduresSnapshot = await getDocs29(proceduresQuery);
15239
15239
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
15240
- const procedures = proceduresSnapshot.docs.map((doc38) => {
15241
- const data = doc38.data();
15240
+ const procedures = proceduresSnapshot.docs.map((doc37) => {
15241
+ const data = doc37.data();
15242
15242
  return {
15243
15243
  ...data,
15244
- id: doc38.id
15244
+ id: doc37.id
15245
15245
  // Ensure ID is present
15246
15246
  };
15247
15247
  });
@@ -15323,8 +15323,8 @@ var ProcedureService = class extends BaseService {
15323
15323
  console.log(
15324
15324
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
15325
15325
  );
15326
- for (const doc38 of querySnapshot.docs) {
15327
- const procedure = { ...doc38.data(), id: doc38.id };
15326
+ for (const doc37 of querySnapshot.docs) {
15327
+ const procedure = { ...doc37.data(), id: doc37.id };
15328
15328
  const distance = distanceBetween6(
15329
15329
  [center.latitude, center.longitude],
15330
15330
  [
@@ -15375,8 +15375,8 @@ var ProcedureService = class extends BaseService {
15375
15375
  console.log(
15376
15376
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
15377
15377
  );
15378
- const procedures = querySnapshot.docs.map((doc38) => {
15379
- return { ...doc38.data(), id: doc38.id };
15378
+ const procedures = querySnapshot.docs.map((doc37) => {
15379
+ return { ...doc37.data(), id: doc37.id };
15380
15380
  });
15381
15381
  if (filters.location) {
15382
15382
  const center = filters.location;
@@ -15719,7 +15719,7 @@ var ReviewService = class extends BaseService {
15719
15719
  where30("patientId", "==", patientId)
15720
15720
  );
15721
15721
  const snapshot = await getDocs30(q);
15722
- return snapshot.docs.map((doc38) => doc38.data());
15722
+ return snapshot.docs.map((doc37) => doc37.data());
15723
15723
  }
15724
15724
  /**
15725
15725
  * Gets all reviews for a specific clinic
@@ -15732,7 +15732,7 @@ var ReviewService = class extends BaseService {
15732
15732
  where30("clinicReview.clinicId", "==", clinicId)
15733
15733
  );
15734
15734
  const snapshot = await getDocs30(q);
15735
- return snapshot.docs.map((doc38) => doc38.data());
15735
+ return snapshot.docs.map((doc37) => doc37.data());
15736
15736
  }
15737
15737
  /**
15738
15738
  * Gets all reviews for a specific practitioner
@@ -15745,7 +15745,7 @@ var ReviewService = class extends BaseService {
15745
15745
  where30("practitionerReview.practitionerId", "==", practitionerId)
15746
15746
  );
15747
15747
  const snapshot = await getDocs30(q);
15748
- return snapshot.docs.map((doc38) => doc38.data());
15748
+ return snapshot.docs.map((doc37) => doc37.data());
15749
15749
  }
15750
15750
  /**
15751
15751
  * Gets all reviews for a specific procedure
@@ -15758,7 +15758,7 @@ var ReviewService = class extends BaseService {
15758
15758
  where30("procedureReview.procedureId", "==", procedureId)
15759
15759
  );
15760
15760
  const snapshot = await getDocs30(q);
15761
- return snapshot.docs.map((doc38) => doc38.data());
15761
+ return snapshot.docs.map((doc37) => doc37.data());
15762
15762
  }
15763
15763
  /**
15764
15764
  * Gets all reviews for a specific appointment
@@ -16071,12 +16071,11 @@ var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
16071
16071
  TimeUnit2["DAYS"] = "days";
16072
16072
  return TimeUnit2;
16073
16073
  })(TimeUnit || {});
16074
- var RequirementType = /* @__PURE__ */ ((RequirementType3) => {
16075
- RequirementType3["PRE"] = "pre";
16076
- RequirementType3["POST"] = "post";
16077
- return RequirementType3;
16074
+ var RequirementType = /* @__PURE__ */ ((RequirementType2) => {
16075
+ RequirementType2["PRE"] = "pre";
16076
+ RequirementType2["POST"] = "post";
16077
+ return RequirementType2;
16078
16078
  })(RequirementType || {});
16079
- var REQUIREMENTS_COLLECTION = "backoffice_requirements";
16080
16079
 
16081
16080
  // src/backoffice/validations/schemas.ts
16082
16081
  var blockingConditionSchemaBackoffice = z29.nativeEnum(BlockingCondition);
@@ -16470,9 +16469,9 @@ var BrandService = class extends BaseService {
16470
16469
  const q = query31(this.getBrandsRef(), where31("isActive", "==", true));
16471
16470
  const snapshot = await getDocs31(q);
16472
16471
  return snapshot.docs.map(
16473
- (doc38) => ({
16474
- id: doc38.id,
16475
- ...doc38.data()
16472
+ (doc37) => ({
16473
+ id: doc37.id,
16474
+ ...doc37.data()
16476
16475
  })
16477
16476
  );
16478
16477
  }
@@ -16557,9 +16556,9 @@ var CategoryService = class extends BaseService {
16557
16556
  const q = query32(this.categoriesRef, where32("isActive", "==", true));
16558
16557
  const snapshot = await getDocs32(q);
16559
16558
  return snapshot.docs.map(
16560
- (doc38) => ({
16561
- id: doc38.id,
16562
- ...doc38.data()
16559
+ (doc37) => ({
16560
+ id: doc37.id,
16561
+ ...doc37.data()
16563
16562
  })
16564
16563
  );
16565
16564
  }
@@ -16576,9 +16575,9 @@ var CategoryService = class extends BaseService {
16576
16575
  );
16577
16576
  const snapshot = await getDocs32(q);
16578
16577
  return snapshot.docs.map(
16579
- (doc38) => ({
16580
- id: doc38.id,
16581
- ...doc38.data()
16578
+ (doc37) => ({
16579
+ id: doc37.id,
16580
+ ...doc37.data()
16582
16581
  })
16583
16582
  );
16584
16583
  }
@@ -16620,100 +16619,7 @@ var CategoryService = class extends BaseService {
16620
16619
  }
16621
16620
  };
16622
16621
 
16623
- // src/backoffice/services/documentation-template.service.ts
16624
- var DocumentationTemplateServiceBackoffice = class {
16625
- /**
16626
- * Constructor for DocumentationTemplateService
16627
- * @param db - Firestore instance
16628
- * @param auth - Firebase Auth instance
16629
- * @param app - Firebase App instance
16630
- */
16631
- constructor(db, auth, app) {
16632
- this.apiService = new DocumentationTemplateService(db, auth, app);
16633
- }
16634
- /**
16635
- * Create a new document template
16636
- * @param data - Template data
16637
- * @param userId - ID of the user creating the template
16638
- * @returns The created template
16639
- */
16640
- async createTemplate(data, userId) {
16641
- return this.apiService.createTemplate(data, userId);
16642
- }
16643
- /**
16644
- * Get a document template by ID
16645
- * @param templateId - ID of the template to retrieve
16646
- * @param version - Optional version number to retrieve (defaults to latest version)
16647
- * @returns The template or null if not found
16648
- */
16649
- async getTemplateById(templateId, version) {
16650
- return this.apiService.getTemplateById(templateId, version);
16651
- }
16652
- /**
16653
- * Update an existing document template
16654
- * @param templateId - ID of the template to update
16655
- * @param data - Updated template data
16656
- * @returns The updated template
16657
- */
16658
- async updateTemplate(templateId, data) {
16659
- return this.apiService.updateTemplate(templateId, data);
16660
- }
16661
- /**
16662
- * Delete a document template
16663
- * @param templateId - ID of the template to delete
16664
- */
16665
- async deleteTemplate(templateId) {
16666
- return this.apiService.deleteTemplate(templateId);
16667
- }
16668
- /**
16669
- * Get all active templates
16670
- * @param pageSize - Number of templates to retrieve
16671
- * @param lastDoc - Last document from previous page for pagination
16672
- * @returns Array of templates and the last document for pagination
16673
- */
16674
- async getActiveTemplates(pageSize = 20, lastDoc) {
16675
- return this.apiService.getActiveTemplates(pageSize, lastDoc);
16676
- }
16677
- /**
16678
- * Get templates by tags
16679
- * @param tags - Tags to filter by
16680
- * @param pageSize - Number of templates to retrieve
16681
- * @param lastDoc - Last document from previous page for pagination
16682
- * @returns Array of templates and the last document for pagination
16683
- */
16684
- async getTemplatesByTags(tags, pageSize = 20, lastDoc) {
16685
- return this.apiService.getTemplatesByTags(tags, pageSize, lastDoc);
16686
- }
16687
- /**
16688
- * Get templates created by a specific user
16689
- * @param userId - ID of the user who created the templates
16690
- * @param pageSize - Number of templates to retrieve
16691
- * @param lastDoc - Last document from previous page for pagination
16692
- * @returns Array of templates and the last document for pagination
16693
- */
16694
- async getTemplatesByCreator(userId, pageSize = 20, lastDoc) {
16695
- return this.apiService.getTemplatesByCreator(userId, pageSize, lastDoc);
16696
- }
16697
- /**
16698
- * Get a specific version of a template
16699
- * @param templateId - ID of the template
16700
- * @param versionNumber - Version number to retrieve
16701
- * @returns The template version or null if not found
16702
- */
16703
- async getTemplateVersion(templateId, versionNumber) {
16704
- return this.apiService.getTemplateVersion(templateId, versionNumber);
16705
- }
16706
- /**
16707
- * Get all versions of a template
16708
- * @param templateId - ID of the template
16709
- * @returns Array of template versions
16710
- */
16711
- async getTemplateVersions(templateId) {
16712
- return this.apiService.getTemplateOldVersions(templateId);
16713
- }
16714
- };
16715
-
16716
- // src/backoffice/services/product.service.ts
16622
+ // src/backoffice/services/subcategory.service.ts
16717
16623
  import {
16718
16624
  addDoc as addDoc5,
16719
16625
  collection as collection33,
@@ -16725,235 +16631,6 @@ import {
16725
16631
  where as where33
16726
16632
  } from "firebase/firestore";
16727
16633
 
16728
- // src/backoffice/types/product.types.ts
16729
- var PRODUCTS_COLLECTION = "products";
16730
-
16731
- // src/backoffice/services/product.service.ts
16732
- var ProductService = class extends BaseService {
16733
- /**
16734
- * Gets reference to products collection under a technology
16735
- * @param technologyId - ID of the technology
16736
- * @returns Firestore collection reference
16737
- */
16738
- getProductsRef(technologyId) {
16739
- return collection33(
16740
- this.db,
16741
- TECHNOLOGIES_COLLECTION,
16742
- technologyId,
16743
- PRODUCTS_COLLECTION
16744
- );
16745
- }
16746
- /**
16747
- * Creates a new product under technology
16748
- */
16749
- async create(technologyId, brandId, product) {
16750
- const now = /* @__PURE__ */ new Date();
16751
- const newProduct = {
16752
- ...product,
16753
- brandId,
16754
- technologyId,
16755
- createdAt: now,
16756
- updatedAt: now,
16757
- isActive: true
16758
- };
16759
- const productRef = await addDoc5(
16760
- this.getProductsRef(technologyId),
16761
- newProduct
16762
- );
16763
- return { id: productRef.id, ...newProduct };
16764
- }
16765
- /**
16766
- * Gets all products for a technology
16767
- */
16768
- async getAllByTechnology(technologyId) {
16769
- const q = query33(
16770
- this.getProductsRef(technologyId),
16771
- where33("isActive", "==", true)
16772
- );
16773
- const snapshot = await getDocs33(q);
16774
- return snapshot.docs.map(
16775
- (doc38) => ({
16776
- id: doc38.id,
16777
- ...doc38.data()
16778
- })
16779
- );
16780
- }
16781
- /**
16782
- * Gets all products for a brand by filtering through all technologies
16783
- */
16784
- async getAllByBrand(brandId) {
16785
- const allTechnologiesRef = collection33(this.db, TECHNOLOGIES_COLLECTION);
16786
- const technologiesSnapshot = await getDocs33(allTechnologiesRef);
16787
- const products = [];
16788
- for (const techDoc of technologiesSnapshot.docs) {
16789
- const q = query33(
16790
- this.getProductsRef(techDoc.id),
16791
- where33("brandId", "==", brandId),
16792
- where33("isActive", "==", true)
16793
- );
16794
- const snapshot = await getDocs33(q);
16795
- products.push(
16796
- ...snapshot.docs.map(
16797
- (doc38) => ({
16798
- id: doc38.id,
16799
- ...doc38.data()
16800
- })
16801
- )
16802
- );
16803
- }
16804
- return products;
16805
- }
16806
- /**
16807
- * Updates a product
16808
- */
16809
- async update(technologyId, productId, product) {
16810
- const updateData = {
16811
- ...product,
16812
- updatedAt: /* @__PURE__ */ new Date()
16813
- };
16814
- const docRef = doc34(this.getProductsRef(technologyId), productId);
16815
- await updateDoc32(docRef, updateData);
16816
- return this.getById(technologyId, productId);
16817
- }
16818
- /**
16819
- * Soft deletes a product
16820
- */
16821
- async delete(technologyId, productId) {
16822
- await this.update(technologyId, productId, {
16823
- isActive: false
16824
- });
16825
- }
16826
- /**
16827
- * Gets a product by ID
16828
- */
16829
- async getById(technologyId, productId) {
16830
- const docRef = doc34(this.getProductsRef(technologyId), productId);
16831
- const docSnap = await getDoc36(docRef);
16832
- if (!docSnap.exists()) return null;
16833
- return {
16834
- id: docSnap.id,
16835
- ...docSnap.data()
16836
- };
16837
- }
16838
- };
16839
-
16840
- // src/backoffice/services/requirement.service.ts
16841
- import {
16842
- addDoc as addDoc6,
16843
- collection as collection34,
16844
- doc as doc35,
16845
- getDoc as getDoc37,
16846
- getDocs as getDocs34,
16847
- query as query34,
16848
- updateDoc as updateDoc33,
16849
- where as where34
16850
- } from "firebase/firestore";
16851
- var RequirementService = class extends BaseService {
16852
- /**
16853
- * Referenca na Firestore kolekciju zahteva
16854
- */
16855
- get requirementsRef() {
16856
- return collection34(this.db, REQUIREMENTS_COLLECTION);
16857
- }
16858
- /**
16859
- * Kreira novi globalni zahtev
16860
- * @param requirement - Podaci za novi zahtev
16861
- * @returns Kreirani zahtev sa generisanim ID-em
16862
- */
16863
- async create(requirement) {
16864
- const now = /* @__PURE__ */ new Date();
16865
- const newRequirement = {
16866
- ...requirement,
16867
- createdAt: now,
16868
- updatedAt: now,
16869
- isActive: true
16870
- };
16871
- const docRef = await addDoc6(this.requirementsRef, newRequirement);
16872
- return { id: docRef.id, ...newRequirement };
16873
- }
16874
- /**
16875
- * Vraća sve aktivne zahteve
16876
- * @returns Lista aktivnih zahteva
16877
- */
16878
- async getAll() {
16879
- const q = query34(this.requirementsRef, where34("isActive", "==", true));
16880
- const snapshot = await getDocs34(q);
16881
- return snapshot.docs.map(
16882
- (doc38) => ({
16883
- id: doc38.id,
16884
- ...doc38.data()
16885
- })
16886
- );
16887
- }
16888
- /**
16889
- * Vraća sve aktivne zahteve određenog tipa
16890
- * @param type - Tip zahteva (pre/post)
16891
- * @returns Lista zahteva određenog tipa
16892
- */
16893
- async getAllByType(type) {
16894
- const q = query34(
16895
- this.requirementsRef,
16896
- where34("type", "==", type),
16897
- where34("isActive", "==", true)
16898
- );
16899
- const snapshot = await getDocs34(q);
16900
- return snapshot.docs.map(
16901
- (doc38) => ({
16902
- id: doc38.id,
16903
- ...doc38.data()
16904
- })
16905
- );
16906
- }
16907
- /**
16908
- * Ažurira postojeći zahtev
16909
- * @param id - ID zahteva koji se ažurira
16910
- * @param requirement - Novi podaci za zahtev
16911
- * @returns Ažurirani zahtev
16912
- */
16913
- async update(id, requirement) {
16914
- const updateData = {
16915
- ...requirement,
16916
- updatedAt: /* @__PURE__ */ new Date()
16917
- };
16918
- const docRef = doc35(this.requirementsRef, id);
16919
- await updateDoc33(docRef, updateData);
16920
- return this.getById(id);
16921
- }
16922
- /**
16923
- * Soft delete zahteva (postavlja isActive na false)
16924
- * @param id - ID zahteva koji se briše
16925
- */
16926
- async delete(id) {
16927
- await this.update(id, { isActive: false });
16928
- }
16929
- /**
16930
- * Vraća zahtev po ID-u
16931
- * @param id - ID traženog zahteva
16932
- * @returns Zahtev ili null ako ne postoji
16933
- */
16934
- async getById(id) {
16935
- const docRef = doc35(this.requirementsRef, id);
16936
- const docSnap = await getDoc37(docRef);
16937
- if (!docSnap.exists()) return null;
16938
- return {
16939
- id: docSnap.id,
16940
- ...docSnap.data()
16941
- };
16942
- }
16943
- };
16944
-
16945
- // src/backoffice/services/subcategory.service.ts
16946
- import {
16947
- addDoc as addDoc7,
16948
- collection as collection35,
16949
- doc as doc36,
16950
- getDoc as getDoc38,
16951
- getDocs as getDocs35,
16952
- query as query35,
16953
- updateDoc as updateDoc34,
16954
- where as where35
16955
- } from "firebase/firestore";
16956
-
16957
16634
  // src/backoffice/types/subcategory.types.ts
16958
16635
  var SUBCATEGORIES_COLLECTION = "subcategories";
16959
16636
 
@@ -16964,7 +16641,7 @@ var SubcategoryService = class extends BaseService {
16964
16641
  * @param categoryId - ID roditeljske kategorije
16965
16642
  */
16966
16643
  getSubcategoriesRef(categoryId) {
16967
- return collection35(
16644
+ return collection33(
16968
16645
  this.db,
16969
16646
  CATEGORIES_COLLECTION,
16970
16647
  categoryId,
@@ -16986,7 +16663,7 @@ var SubcategoryService = class extends BaseService {
16986
16663
  updatedAt: now,
16987
16664
  isActive: true
16988
16665
  };
16989
- const docRef = await addDoc7(
16666
+ const docRef = await addDoc5(
16990
16667
  this.getSubcategoriesRef(categoryId),
16991
16668
  newSubcategory
16992
16669
  );
@@ -16998,15 +16675,15 @@ var SubcategoryService = class extends BaseService {
16998
16675
  * @returns Lista aktivnih podkategorija
16999
16676
  */
17000
16677
  async getAllByCategoryId(categoryId) {
17001
- const q = query35(
16678
+ const q = query33(
17002
16679
  this.getSubcategoriesRef(categoryId),
17003
- where35("isActive", "==", true)
16680
+ where33("isActive", "==", true)
17004
16681
  );
17005
- const snapshot = await getDocs35(q);
16682
+ const snapshot = await getDocs33(q);
17006
16683
  return snapshot.docs.map(
17007
- (doc38) => ({
17008
- id: doc38.id,
17009
- ...doc38.data()
16684
+ (doc37) => ({
16685
+ id: doc37.id,
16686
+ ...doc37.data()
17010
16687
  })
17011
16688
  );
17012
16689
  }
@@ -17022,8 +16699,8 @@ var SubcategoryService = class extends BaseService {
17022
16699
  ...subcategory,
17023
16700
  updatedAt: /* @__PURE__ */ new Date()
17024
16701
  };
17025
- const docRef = doc36(this.getSubcategoriesRef(categoryId), subcategoryId);
17026
- await updateDoc34(docRef, updateData);
16702
+ const docRef = doc34(this.getSubcategoriesRef(categoryId), subcategoryId);
16703
+ await updateDoc32(docRef, updateData);
17027
16704
  return this.getById(categoryId, subcategoryId);
17028
16705
  }
17029
16706
  /**
@@ -17041,8 +16718,8 @@ var SubcategoryService = class extends BaseService {
17041
16718
  * @returns Podkategorija ili null ako ne postoji
17042
16719
  */
17043
16720
  async getById(categoryId, subcategoryId) {
17044
- const docRef = doc36(this.getSubcategoriesRef(categoryId), subcategoryId);
17045
- const docSnap = await getDoc38(docRef);
16721
+ const docRef = doc34(this.getSubcategoriesRef(categoryId), subcategoryId);
16722
+ const docSnap = await getDoc36(docRef);
17046
16723
  if (!docSnap.exists()) return null;
17047
16724
  return {
17048
16725
  id: docSnap.id,
@@ -17053,14 +16730,14 @@ var SubcategoryService = class extends BaseService {
17053
16730
 
17054
16731
  // src/backoffice/services/technology.service.ts
17055
16732
  import {
17056
- addDoc as addDoc8,
17057
- collection as collection36,
17058
- doc as doc37,
17059
- getDoc as getDoc39,
17060
- getDocs as getDocs36,
17061
- query as query36,
17062
- updateDoc as updateDoc35,
17063
- where as where36,
16733
+ addDoc as addDoc6,
16734
+ collection as collection34,
16735
+ doc as doc35,
16736
+ getDoc as getDoc37,
16737
+ getDocs as getDocs34,
16738
+ query as query34,
16739
+ updateDoc as updateDoc33,
16740
+ where as where34,
17064
16741
  arrayUnion as arrayUnion9,
17065
16742
  arrayRemove as arrayRemove8
17066
16743
  } from "firebase/firestore";
@@ -17073,7 +16750,7 @@ var TechnologyService = class extends BaseService {
17073
16750
  * Vraća referencu na Firestore kolekciju tehnologija
17074
16751
  */
17075
16752
  getTechnologiesRef() {
17076
- return collection36(this.db, TECHNOLOGIES_COLLECTION);
16753
+ return collection34(this.db, TECHNOLOGIES_COLLECTION);
17077
16754
  }
17078
16755
  /**
17079
16756
  * Kreira novu tehnologiju
@@ -17096,7 +16773,7 @@ var TechnologyService = class extends BaseService {
17096
16773
  benefits: technology.benefits || [],
17097
16774
  certificationRequirement: technology.certificationRequirement || DEFAULT_CERTIFICATION_REQUIREMENT
17098
16775
  };
17099
- const docRef = await addDoc8(this.getTechnologiesRef(), newTechnology);
16776
+ const docRef = await addDoc6(this.getTechnologiesRef(), newTechnology);
17100
16777
  return { id: docRef.id, ...newTechnology };
17101
16778
  }
17102
16779
  /**
@@ -17104,12 +16781,12 @@ var TechnologyService = class extends BaseService {
17104
16781
  * @returns Lista aktivnih tehnologija
17105
16782
  */
17106
16783
  async getAll() {
17107
- const q = query36(this.getTechnologiesRef(), where36("isActive", "==", true));
17108
- const snapshot = await getDocs36(q);
16784
+ const q = query34(this.getTechnologiesRef(), where34("isActive", "==", true));
16785
+ const snapshot = await getDocs34(q);
17109
16786
  return snapshot.docs.map(
17110
- (doc38) => ({
17111
- id: doc38.id,
17112
- ...doc38.data()
16787
+ (doc37) => ({
16788
+ id: doc37.id,
16789
+ ...doc37.data()
17113
16790
  })
17114
16791
  );
17115
16792
  }
@@ -17119,16 +16796,16 @@ var TechnologyService = class extends BaseService {
17119
16796
  * @returns Lista aktivnih tehnologija
17120
16797
  */
17121
16798
  async getAllByFamily(family) {
17122
- const q = query36(
16799
+ const q = query34(
17123
16800
  this.getTechnologiesRef(),
17124
- where36("isActive", "==", true),
17125
- where36("family", "==", family)
16801
+ where34("isActive", "==", true),
16802
+ where34("family", "==", family)
17126
16803
  );
17127
- const snapshot = await getDocs36(q);
16804
+ const snapshot = await getDocs34(q);
17128
16805
  return snapshot.docs.map(
17129
- (doc38) => ({
17130
- id: doc38.id,
17131
- ...doc38.data()
16806
+ (doc37) => ({
16807
+ id: doc37.id,
16808
+ ...doc37.data()
17132
16809
  })
17133
16810
  );
17134
16811
  }
@@ -17138,16 +16815,16 @@ var TechnologyService = class extends BaseService {
17138
16815
  * @returns Lista aktivnih tehnologija
17139
16816
  */
17140
16817
  async getAllByCategoryId(categoryId) {
17141
- const q = query36(
16818
+ const q = query34(
17142
16819
  this.getTechnologiesRef(),
17143
- where36("isActive", "==", true),
17144
- where36("categoryId", "==", categoryId)
16820
+ where34("isActive", "==", true),
16821
+ where34("categoryId", "==", categoryId)
17145
16822
  );
17146
- const snapshot = await getDocs36(q);
16823
+ const snapshot = await getDocs34(q);
17147
16824
  return snapshot.docs.map(
17148
- (doc38) => ({
17149
- id: doc38.id,
17150
- ...doc38.data()
16825
+ (doc37) => ({
16826
+ id: doc37.id,
16827
+ ...doc37.data()
17151
16828
  })
17152
16829
  );
17153
16830
  }
@@ -17157,16 +16834,16 @@ var TechnologyService = class extends BaseService {
17157
16834
  * @returns Lista aktivnih tehnologija
17158
16835
  */
17159
16836
  async getAllBySubcategoryId(subcategoryId) {
17160
- const q = query36(
16837
+ const q = query34(
17161
16838
  this.getTechnologiesRef(),
17162
- where36("isActive", "==", true),
17163
- where36("subcategoryId", "==", subcategoryId)
16839
+ where34("isActive", "==", true),
16840
+ where34("subcategoryId", "==", subcategoryId)
17164
16841
  );
17165
- const snapshot = await getDocs36(q);
16842
+ const snapshot = await getDocs34(q);
17166
16843
  return snapshot.docs.map(
17167
- (doc38) => ({
17168
- id: doc38.id,
17169
- ...doc38.data()
16844
+ (doc37) => ({
16845
+ id: doc37.id,
16846
+ ...doc37.data()
17170
16847
  })
17171
16848
  );
17172
16849
  }
@@ -17181,8 +16858,8 @@ var TechnologyService = class extends BaseService {
17181
16858
  ...technology,
17182
16859
  updatedAt: /* @__PURE__ */ new Date()
17183
16860
  };
17184
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17185
- await updateDoc35(docRef, updateData);
16861
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16862
+ await updateDoc33(docRef, updateData);
17186
16863
  return this.getById(technologyId);
17187
16864
  }
17188
16865
  /**
@@ -17200,8 +16877,8 @@ var TechnologyService = class extends BaseService {
17200
16877
  * @returns Tehnologija ili null ako ne postoji
17201
16878
  */
17202
16879
  async getById(technologyId) {
17203
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17204
- const docSnap = await getDoc39(docRef);
16880
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16881
+ const docSnap = await getDoc37(docRef);
17205
16882
  if (!docSnap.exists()) return null;
17206
16883
  return {
17207
16884
  id: docSnap.id,
@@ -17215,9 +16892,9 @@ var TechnologyService = class extends BaseService {
17215
16892
  * @returns Ažurirana tehnologija sa novim zahtevom
17216
16893
  */
17217
16894
  async addRequirement(technologyId, requirement) {
17218
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
16895
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
17219
16896
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
17220
- await updateDoc35(docRef, {
16897
+ await updateDoc33(docRef, {
17221
16898
  [requirementType]: arrayUnion9(requirement),
17222
16899
  updatedAt: /* @__PURE__ */ new Date()
17223
16900
  });
@@ -17230,9 +16907,9 @@ var TechnologyService = class extends BaseService {
17230
16907
  * @returns Ažurirana tehnologija bez uklonjenog zahteva
17231
16908
  */
17232
16909
  async removeRequirement(technologyId, requirement) {
17233
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
16910
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
17234
16911
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
17235
- await updateDoc35(docRef, {
16912
+ await updateDoc33(docRef, {
17236
16913
  [requirementType]: arrayRemove8(requirement),
17237
16914
  updatedAt: /* @__PURE__ */ new Date()
17238
16915
  });
@@ -17270,8 +16947,8 @@ var TechnologyService = class extends BaseService {
17270
16947
  * @returns Ažurirana tehnologija
17271
16948
  */
17272
16949
  async addBlockingCondition(technologyId, condition) {
17273
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17274
- await updateDoc35(docRef, {
16950
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16951
+ await updateDoc33(docRef, {
17275
16952
  blockingConditions: arrayUnion9(condition),
17276
16953
  updatedAt: /* @__PURE__ */ new Date()
17277
16954
  });
@@ -17284,8 +16961,8 @@ var TechnologyService = class extends BaseService {
17284
16961
  * @returns Ažurirana tehnologija
17285
16962
  */
17286
16963
  async removeBlockingCondition(technologyId, condition) {
17287
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17288
- await updateDoc35(docRef, {
16964
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16965
+ await updateDoc33(docRef, {
17289
16966
  blockingConditions: arrayRemove8(condition),
17290
16967
  updatedAt: /* @__PURE__ */ new Date()
17291
16968
  });
@@ -17298,8 +16975,8 @@ var TechnologyService = class extends BaseService {
17298
16975
  * @returns Ažurirana tehnologija
17299
16976
  */
17300
16977
  async addContraindication(technologyId, contraindication) {
17301
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17302
- await updateDoc35(docRef, {
16978
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16979
+ await updateDoc33(docRef, {
17303
16980
  contraindications: arrayUnion9(contraindication),
17304
16981
  updatedAt: /* @__PURE__ */ new Date()
17305
16982
  });
@@ -17312,8 +16989,8 @@ var TechnologyService = class extends BaseService {
17312
16989
  * @returns Ažurirana tehnologija
17313
16990
  */
17314
16991
  async removeContraindication(technologyId, contraindication) {
17315
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17316
- await updateDoc35(docRef, {
16992
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
16993
+ await updateDoc33(docRef, {
17317
16994
  contraindications: arrayRemove8(contraindication),
17318
16995
  updatedAt: /* @__PURE__ */ new Date()
17319
16996
  });
@@ -17326,8 +17003,8 @@ var TechnologyService = class extends BaseService {
17326
17003
  * @returns Ažurirana tehnologija
17327
17004
  */
17328
17005
  async addBenefit(technologyId, benefit) {
17329
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17330
- await updateDoc35(docRef, {
17006
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
17007
+ await updateDoc33(docRef, {
17331
17008
  benefits: arrayUnion9(benefit),
17332
17009
  updatedAt: /* @__PURE__ */ new Date()
17333
17010
  });
@@ -17340,8 +17017,8 @@ var TechnologyService = class extends BaseService {
17340
17017
  * @returns Ažurirana tehnologija
17341
17018
  */
17342
17019
  async removeBenefit(technologyId, benefit) {
17343
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17344
- await updateDoc35(docRef, {
17020
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
17021
+ await updateDoc33(docRef, {
17345
17022
  benefits: arrayRemove8(benefit),
17346
17023
  updatedAt: /* @__PURE__ */ new Date()
17347
17024
  });
@@ -17381,8 +17058,8 @@ var TechnologyService = class extends BaseService {
17381
17058
  * @returns Ažurirana tehnologija
17382
17059
  */
17383
17060
  async updateCertificationRequirement(technologyId, certificationRequirement) {
17384
- const docRef = doc37(this.getTechnologiesRef(), technologyId);
17385
- await updateDoc35(docRef, {
17061
+ const docRef = doc35(this.getTechnologiesRef(), technologyId);
17062
+ await updateDoc33(docRef, {
17386
17063
  certificationRequirement,
17387
17064
  updatedAt: /* @__PURE__ */ new Date()
17388
17065
  });
@@ -17481,149 +17158,127 @@ var TechnologyService = class extends BaseService {
17481
17158
  }
17482
17159
  };
17483
17160
 
17484
- // src/backoffice/constants/certification.constants.ts
17485
- var DEFAULT_CERTIFICATION_REQUIREMENT2 = {
17486
- minimumLevel: "aesthetician" /* AESTHETICIAN */,
17487
- requiredSpecialties: []
17488
- };
17161
+ // src/backoffice/services/product.service.ts
17162
+ import {
17163
+ addDoc as addDoc7,
17164
+ collection as collection35,
17165
+ doc as doc36,
17166
+ getDoc as getDoc38,
17167
+ getDocs as getDocs35,
17168
+ query as query35,
17169
+ updateDoc as updateDoc34,
17170
+ where as where35
17171
+ } from "firebase/firestore";
17489
17172
 
17490
- // src/backoffice/errors/backoffice.errors.ts
17491
- var BackofficeError = class extends Error {
17492
- constructor(message) {
17493
- super(message);
17494
- this.name = "BackofficeError";
17495
- }
17496
- };
17497
- var CategoryError = class extends BackofficeError {
17498
- constructor(message) {
17499
- super(message);
17500
- this.name = "CategoryError";
17501
- }
17502
- };
17503
- var CategoryNotFoundError = class extends CategoryError {
17504
- constructor(id) {
17505
- super(`Kategorija sa ID-em ${id} nije prona\u0111ena`);
17506
- this.name = "CategoryNotFoundError";
17507
- }
17508
- };
17509
- var InvalidCategoryDataError = class extends CategoryError {
17510
- constructor(message) {
17511
- super(`Neva\u017Ee\u0107i podaci za kategoriju: ${message}`);
17512
- this.name = "InvalidCategoryDataError";
17513
- }
17514
- };
17515
- var SubcategoryError = class extends BackofficeError {
17516
- constructor(message) {
17517
- super(message);
17518
- this.name = "SubcategoryError";
17519
- }
17520
- };
17521
- var SubcategoryNotFoundError = class extends SubcategoryError {
17522
- constructor(id) {
17523
- super(`Podkategorija sa ID-em ${id} nije prona\u0111ena`);
17524
- this.name = "SubcategoryNotFoundError";
17525
- }
17526
- };
17527
- var InvalidSubcategoryDataError = class extends SubcategoryError {
17528
- constructor(message) {
17529
- super(`Neva\u017Ee\u0107i podaci za podkategoriju: ${message}`);
17530
- this.name = "InvalidSubcategoryDataError";
17531
- }
17532
- };
17533
- var TechnologyError = class extends BackofficeError {
17534
- constructor(message) {
17535
- super(message);
17536
- this.name = "TechnologyError";
17537
- }
17538
- };
17539
- var TechnologyNotFoundError = class extends TechnologyError {
17540
- constructor(id) {
17541
- super(`Tehnologija sa ID-em ${id} nije prona\u0111ena`);
17542
- this.name = "TechnologyNotFoundError";
17543
- }
17544
- };
17545
- var InvalidTechnologyDataError = class extends TechnologyError {
17546
- constructor(message) {
17547
- super(`Neva\u017Ee\u0107i podaci za tehnologiju: ${message}`);
17548
- this.name = "InvalidTechnologyDataError";
17549
- }
17550
- };
17551
- var RequirementError = class extends BackofficeError {
17552
- constructor(message) {
17553
- super(message);
17554
- this.name = "RequirementError";
17555
- }
17556
- };
17557
- var RequirementNotFoundError = class extends RequirementError {
17558
- constructor(id) {
17559
- super(`Zahtev sa ID-em ${id} nije prona\u0111en`);
17560
- this.name = "RequirementNotFoundError";
17561
- }
17562
- };
17563
- var InvalidRequirementDataError = class extends RequirementError {
17564
- constructor(message) {
17565
- super(`Neva\u017Ee\u0107i podaci za zahtev: ${message}`);
17566
- this.name = "InvalidRequirementDataError";
17567
- }
17568
- };
17569
- var InvalidTimeframeError = class extends RequirementError {
17570
- constructor(message) {
17571
- super(`Invalid timeframe: ${message}`);
17572
- this.name = "InvalidTimeframeError";
17573
- }
17574
- };
17575
- var RelationshipError = class extends BackofficeError {
17576
- constructor(message) {
17577
- super(message);
17578
- this.name = "RelationshipError";
17579
- }
17580
- };
17581
- var InvalidHierarchyError = class extends RelationshipError {
17582
- constructor(message) {
17583
- super(`Invalid hierarchy: ${message}`);
17584
- this.name = "InvalidHierarchyError";
17585
- }
17586
- };
17587
- var CircularReferenceError = class extends RelationshipError {
17588
- constructor(message) {
17589
- super(`Circular reference detected: ${message}`);
17590
- this.name = "CircularReferenceError";
17173
+ // src/backoffice/types/product.types.ts
17174
+ var PRODUCTS_COLLECTION = "products";
17175
+
17176
+ // src/backoffice/services/product.service.ts
17177
+ var ProductService = class extends BaseService {
17178
+ /**
17179
+ * Gets reference to products collection under a technology
17180
+ * @param technologyId - ID of the technology
17181
+ * @returns Firestore collection reference
17182
+ */
17183
+ getProductsRef(technologyId) {
17184
+ return collection35(
17185
+ this.db,
17186
+ TECHNOLOGIES_COLLECTION,
17187
+ technologyId,
17188
+ PRODUCTS_COLLECTION
17189
+ );
17591
17190
  }
17592
- };
17593
- var BlockingConditionError = class extends BackofficeError {
17594
- constructor(message) {
17595
- super(message);
17596
- this.name = "BlockingConditionError";
17191
+ /**
17192
+ * Creates a new product under technology
17193
+ */
17194
+ async create(technologyId, brandId, product) {
17195
+ const now = /* @__PURE__ */ new Date();
17196
+ const newProduct = {
17197
+ ...product,
17198
+ brandId,
17199
+ technologyId,
17200
+ createdAt: now,
17201
+ updatedAt: now,
17202
+ isActive: true
17203
+ };
17204
+ const productRef = await addDoc7(
17205
+ this.getProductsRef(technologyId),
17206
+ newProduct
17207
+ );
17208
+ return { id: productRef.id, ...newProduct };
17597
17209
  }
17598
- };
17599
- var InvalidBlockingConditionError = class extends BlockingConditionError {
17600
- constructor(condition) {
17601
- super(`Neva\u017Ee\u0107i blokiraju\u0107i uslov: ${condition}`);
17602
- this.name = "InvalidBlockingConditionError";
17210
+ /**
17211
+ * Gets all products for a technology
17212
+ */
17213
+ async getAllByTechnology(technologyId) {
17214
+ const q = query35(
17215
+ this.getProductsRef(technologyId),
17216
+ where35("isActive", "==", true)
17217
+ );
17218
+ const snapshot = await getDocs35(q);
17219
+ return snapshot.docs.map(
17220
+ (doc37) => ({
17221
+ id: doc37.id,
17222
+ ...doc37.data()
17223
+ })
17224
+ );
17603
17225
  }
17604
- };
17605
- var ContraindicationError = class extends BackofficeError {
17606
- constructor(message) {
17607
- super(message);
17608
- this.name = "ContraindicationError";
17226
+ /**
17227
+ * Gets all products for a brand by filtering through all technologies
17228
+ */
17229
+ async getAllByBrand(brandId) {
17230
+ const allTechnologiesRef = collection35(this.db, TECHNOLOGIES_COLLECTION);
17231
+ const technologiesSnapshot = await getDocs35(allTechnologiesRef);
17232
+ const products = [];
17233
+ for (const techDoc of technologiesSnapshot.docs) {
17234
+ const q = query35(
17235
+ this.getProductsRef(techDoc.id),
17236
+ where35("brandId", "==", brandId),
17237
+ where35("isActive", "==", true)
17238
+ );
17239
+ const snapshot = await getDocs35(q);
17240
+ products.push(
17241
+ ...snapshot.docs.map(
17242
+ (doc37) => ({
17243
+ id: doc37.id,
17244
+ ...doc37.data()
17245
+ })
17246
+ )
17247
+ );
17248
+ }
17249
+ return products;
17609
17250
  }
17610
- };
17611
- var InvalidContraindicationError = class extends ContraindicationError {
17612
- constructor(contraindication) {
17613
- super(`Neva\u017Ee\u0107a kontraindikacija: ${contraindication}`);
17614
- this.name = "InvalidContraindicationError";
17251
+ /**
17252
+ * Updates a product
17253
+ */
17254
+ async update(technologyId, productId, product) {
17255
+ const updateData = {
17256
+ ...product,
17257
+ updatedAt: /* @__PURE__ */ new Date()
17258
+ };
17259
+ const docRef = doc36(this.getProductsRef(technologyId), productId);
17260
+ await updateDoc34(docRef, updateData);
17261
+ return this.getById(technologyId, productId);
17615
17262
  }
17616
- };
17617
- var TreatmentBenefitError = class extends BackofficeError {
17618
- constructor(message) {
17619
- super(message);
17620
- this.name = "TreatmentBenefitError";
17263
+ /**
17264
+ * Soft deletes a product
17265
+ */
17266
+ async delete(technologyId, productId) {
17267
+ await this.update(technologyId, productId, {
17268
+ isActive: false
17269
+ });
17621
17270
  }
17622
- };
17623
- var InvalidTreatmentBenefitError = class extends TreatmentBenefitError {
17624
- constructor(benefit) {
17625
- super(`Neva\u017Ee\u0107i benefit tretmana: ${benefit}`);
17626
- this.name = "InvalidTreatmentBenefitError";
17271
+ /**
17272
+ * Gets a product by ID
17273
+ */
17274
+ async getById(technologyId, productId) {
17275
+ const docRef = doc36(this.getProductsRef(technologyId), productId);
17276
+ const docSnap = await getDoc38(docRef);
17277
+ if (!docSnap.exists()) return null;
17278
+ return {
17279
+ id: docSnap.id,
17280
+ ...docSnap.data()
17281
+ };
17627
17282
  }
17628
17283
  };
17629
17284
  export {
@@ -17633,14 +17288,10 @@ export {
17633
17288
  AppointmentService,
17634
17289
  AppointmentStatus,
17635
17290
  AuthService,
17636
- BRANDS_COLLECTION,
17637
- BackofficeError,
17638
17291
  BaseService,
17639
17292
  BlockingCondition,
17640
- BlockingConditionError,
17641
17293
  BrandService,
17642
17294
  CALENDAR_COLLECTION,
17643
- CATEGORIES_COLLECTION,
17644
17295
  CLINICS_COLLECTION,
17645
17296
  CLINIC_ADMINS_COLLECTION,
17646
17297
  CLINIC_GROUPS_COLLECTION,
@@ -17649,28 +17300,22 @@ export {
17649
17300
  CalendarServiceV2,
17650
17301
  CalendarServiceV3,
17651
17302
  CalendarSyncStatus,
17652
- CategoryError,
17653
- CategoryNotFoundError,
17654
17303
  CategoryService,
17655
17304
  CertificationLevel,
17656
17305
  CertificationSpecialty,
17657
- CircularReferenceError,
17658
17306
  ClinicAdminService,
17659
17307
  ClinicGroupService,
17660
17308
  ClinicPhotoTag,
17661
17309
  ClinicService,
17662
17310
  ClinicTag,
17663
17311
  Contraindication,
17664
- ContraindicationError,
17665
17312
  CosmeticAllergySubtype,
17666
17313
  Currency,
17667
- DEFAULT_CERTIFICATION_REQUIREMENT2 as DEFAULT_CERTIFICATION_REQUIREMENT,
17668
17314
  DEFAULT_MEDICAL_INFO,
17669
17315
  DOCTOR_FORMS_SUBCOLLECTION,
17670
17316
  DOCUMENTATION_TEMPLATES_COLLECTION,
17671
17317
  DocumentElementType,
17672
17318
  DocumentationTemplateService,
17673
- DocumentationTemplateServiceBackoffice,
17674
17319
  DynamicVariable,
17675
17320
  EnvironmentalAllergySubtype,
17676
17321
  ExternalCalendarService,
@@ -17681,15 +17326,6 @@ export {
17681
17326
  Gender,
17682
17327
  HeadingLevel,
17683
17328
  INVITE_TOKENS_COLLECTION,
17684
- InvalidBlockingConditionError,
17685
- InvalidCategoryDataError,
17686
- InvalidContraindicationError,
17687
- InvalidHierarchyError,
17688
- InvalidRequirementDataError,
17689
- InvalidSubcategoryDataError,
17690
- InvalidTechnologyDataError,
17691
- InvalidTimeframeError,
17692
- InvalidTreatmentBenefitError,
17693
17329
  Language,
17694
17330
  ListType,
17695
17331
  MEDIA_METADATA_COLLECTION,
@@ -17711,7 +17347,6 @@ export {
17711
17347
  PRACTITIONERS_COLLECTION,
17712
17348
  PRACTITIONER_INVITES_COLLECTION,
17713
17349
  PROCEDURES_COLLECTION,
17714
- PRODUCTS_COLLECTION,
17715
17350
  PatientInstructionStatus,
17716
17351
  PatientRequirementOverallStatus,
17717
17352
  PatientRequirementsService,
@@ -17729,30 +17364,18 @@ export {
17729
17364
  ProcedureService,
17730
17365
  ProductService,
17731
17366
  REGISTER_TOKENS_COLLECTION,
17732
- REQUIREMENTS_COLLECTION,
17733
17367
  REVIEWS_COLLECTION,
17734
- RelationshipError,
17735
- RequirementError,
17736
- RequirementNotFoundError,
17737
- RequirementService,
17738
17368
  RequirementType,
17739
17369
  ReviewService,
17740
- SUBCATEGORIES_COLLECTION,
17741
17370
  SYNCED_CALENDARS_COLLECTION,
17742
17371
  SearchLocationEnum,
17743
- SubcategoryError,
17744
- SubcategoryNotFoundError,
17745
17372
  SubcategoryService,
17746
17373
  SubscriptionModel,
17747
17374
  SyncedCalendarProvider,
17748
- TECHNOLOGIES_COLLECTION,
17749
- TechnologyError,
17750
- TechnologyNotFoundError,
17751
17375
  TechnologyService,
17752
17376
  TimeUnit,
17753
17377
  TimestampUtils,
17754
17378
  TreatmentBenefit,
17755
- TreatmentBenefitError,
17756
17379
  USERS_COLLECTION,
17757
17380
  USER_FORMS_SUBCOLLECTION,
17758
17381
  UserRole,
@@ -17775,15 +17398,9 @@ export {
17775
17398
  beforeAfterPerZoneSchema,
17776
17399
  billingPerZoneSchema,
17777
17400
  blockingConditionSchema,
17778
- blockingConditionSchemaBackoffice,
17779
17401
  buildPractitionerData,
17780
17402
  calendarEventSchema,
17781
17403
  calendarEventTimeSchema,
17782
- categorySchema,
17783
- categoryUpdateSchema,
17784
- certificationLevelSchema,
17785
- certificationRequirementSchema,
17786
- certificationSpecialtySchema,
17787
17404
  checkEmailExists,
17788
17405
  cleanupFirebaseUser,
17789
17406
  clinicAdminOptionsSchema,
@@ -17802,7 +17419,6 @@ export {
17802
17419
  clinicTagsSchema,
17803
17420
  contactPersonSchema,
17804
17421
  contraindicationSchema,
17805
- contraindicationSchemaBackoffice,
17806
17422
  createAdminTokenSchema,
17807
17423
  createAppointmentSchema,
17808
17424
  createBlockingEventSchema,
@@ -17885,7 +17501,6 @@ export {
17885
17501
  preRequirementNotificationSchema,
17886
17502
  procedureCategorizationSchema,
17887
17503
  procedureExtendedInfoSchema,
17888
- procedureFamilySchemaBackoffice,
17889
17504
  procedureInfoSchema,
17890
17505
  procedureReviewInfoSchema,
17891
17506
  procedureReviewSchema,
@@ -17894,26 +17509,15 @@ export {
17894
17509
  requesterInfoSchema,
17895
17510
  requirementImportanceSchema,
17896
17511
  requirementInstructionDueNotificationSchema,
17897
- requirementSchema,
17898
- requirementTypeSchema,
17899
- requirementUpdateSchema,
17900
17512
  rescheduleAppointmentSchema,
17901
17513
  reviewSchema,
17902
17514
  searchAppointmentsSchema,
17903
17515
  searchPatientsSchema,
17904
17516
  sharedClinicContactInfoSchema,
17905
17517
  sharedClinicLocationSchema,
17906
- subcategorySchema,
17907
- subcategoryUpdateSchema,
17908
17518
  syncedCalendarEventSchema,
17909
- technologyRequirementsSchema,
17910
- technologySchema,
17911
- technologyUpdateSchema,
17912
17519
  timeSlotSchema2 as timeSlotSchema,
17913
- timeUnitSchemaBackoffice,
17914
- timeframeSchema,
17915
17520
  timestampSchema,
17916
- treatmentBenefitSchemaBackoffice,
17917
17521
  updateAllergySchema,
17918
17522
  updateAppointmentSchema,
17919
17523
  updateBlockingConditionSchema,