@blackcode_sa/metaestetics-api 1.12.67 → 1.12.68

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.js CHANGED
@@ -17811,9 +17811,9 @@ var ProcedureService = class extends BaseService {
17811
17811
  var _a, _b;
17812
17812
  const procedureId = this.generateId();
17813
17813
  const [category, subcategory, technology] = await Promise.all([
17814
- this.categoryService.getById(data.categoryId),
17815
- this.subcategoryService.getById(data.categoryId, data.subcategoryId),
17816
- this.technologyService.getById(data.technologyId)
17814
+ this.categoryService.getByIdInternal(data.categoryId),
17815
+ this.subcategoryService.getByIdInternal(data.categoryId, data.subcategoryId),
17816
+ this.technologyService.getByIdInternal(data.technologyId)
17817
17817
  ]);
17818
17818
  if (!category || !subcategory || !technology) {
17819
17819
  throw new Error("One or more required base entities not found");
@@ -18750,7 +18750,16 @@ var import_firestore59 = require("firebase/firestore");
18750
18750
  var CATEGORIES_COLLECTION = "backoffice_categories";
18751
18751
 
18752
18752
  // src/backoffice/services/category.service.ts
18753
+ var EXCLUDED_CATEGORY_ID = "consultation";
18753
18754
  var CategoryService = class extends BaseService {
18755
+ /**
18756
+ * Filters out excluded categories from a list.
18757
+ * @param categories - List of categories to filter
18758
+ * @returns Filtered list without excluded categories
18759
+ */
18760
+ filterExcludedCategories(categories) {
18761
+ return categories.filter((cat) => cat.id !== EXCLUDED_CATEGORY_ID);
18762
+ }
18754
18763
  /**
18755
18764
  * Referenca na Firestore kolekciju kategorija
18756
18765
  */
@@ -18787,8 +18796,9 @@ var CategoryService = class extends BaseService {
18787
18796
  (0, import_firestore59.where)("family", "==", family),
18788
18797
  (0, import_firestore59.where)("isActive", "==", active)
18789
18798
  );
18790
- const snapshot = await (0, import_firestore59.getCountFromServer)(q);
18791
- counts[family] = snapshot.data().count;
18799
+ const snapshot = await (0, import_firestore59.getDocs)(q);
18800
+ const filteredDocs = snapshot.docs.filter((doc45) => doc45.id !== EXCLUDED_CATEGORY_ID);
18801
+ counts[family] = filteredDocs.length;
18792
18802
  }
18793
18803
  return counts;
18794
18804
  }
@@ -18799,12 +18809,13 @@ var CategoryService = class extends BaseService {
18799
18809
  async getAllForFilter() {
18800
18810
  const q = (0, import_firestore59.query)(this.categoriesRef, (0, import_firestore59.where)("isActive", "==", true));
18801
18811
  const snapshot = await (0, import_firestore59.getDocs)(q);
18802
- return snapshot.docs.map(
18812
+ const categories = snapshot.docs.map(
18803
18813
  (doc45) => ({
18804
18814
  id: doc45.id,
18805
18815
  ...doc45.data()
18806
18816
  })
18807
18817
  );
18818
+ return this.filterExcludedCategories(categories);
18808
18819
  }
18809
18820
  /**
18810
18821
  * Vraća sve kategorije za određenu familiju za potrebe filtera (bez paginacije)
@@ -18819,12 +18830,13 @@ var CategoryService = class extends BaseService {
18819
18830
  (0, import_firestore59.orderBy)("name")
18820
18831
  );
18821
18832
  const snapshot = await (0, import_firestore59.getDocs)(q);
18822
- return snapshot.docs.map(
18833
+ const categories = snapshot.docs.map(
18823
18834
  (doc45) => ({
18824
18835
  id: doc45.id,
18825
18836
  ...doc45.data()
18826
18837
  })
18827
18838
  );
18839
+ return this.filterExcludedCategories(categories);
18828
18840
  }
18829
18841
  /**
18830
18842
  * Vraća sve kategorije sa paginacijom
@@ -18847,8 +18859,9 @@ var CategoryService = class extends BaseService {
18847
18859
  ...doc45.data()
18848
18860
  })
18849
18861
  );
18862
+ const filteredCategories = this.filterExcludedCategories(categories);
18850
18863
  const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
18851
- return { categories, lastVisible: newLastVisible };
18864
+ return { categories: filteredCategories, lastVisible: newLastVisible };
18852
18865
  }
18853
18866
  /**
18854
18867
  * Vraća sve aktivne kategorije za određenu familiju procedura sa paginacijom
@@ -18873,8 +18886,9 @@ var CategoryService = class extends BaseService {
18873
18886
  ...doc45.data()
18874
18887
  })
18875
18888
  );
18889
+ const filteredCategories = this.filterExcludedCategories(categories);
18876
18890
  const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
18877
- return { categories, lastVisible: newLastVisible };
18891
+ return { categories: filteredCategories, lastVisible: newLastVisible };
18878
18892
  }
18879
18893
  /**
18880
18894
  * Ažurira postojeću kategoriju
@@ -18911,6 +18925,22 @@ var CategoryService = class extends BaseService {
18911
18925
  * @returns Kategorija ili null ako ne postoji
18912
18926
  */
18913
18927
  async getById(id) {
18928
+ if (id === EXCLUDED_CATEGORY_ID) return null;
18929
+ const docRef = (0, import_firestore59.doc)(this.categoriesRef, id);
18930
+ const docSnap = await (0, import_firestore59.getDoc)(docRef);
18931
+ if (!docSnap.exists()) return null;
18932
+ return {
18933
+ id: docSnap.id,
18934
+ ...docSnap.data()
18935
+ };
18936
+ }
18937
+ /**
18938
+ * Internal method to get category by ID without filtering.
18939
+ * Used internally for consultation procedures.
18940
+ * @param id - ID of the category to get
18941
+ * @returns Category or null if not found
18942
+ */
18943
+ async getByIdInternal(id) {
18914
18944
  const docRef = (0, import_firestore59.doc)(this.categoriesRef, id);
18915
18945
  const docSnap = await (0, import_firestore59.getDoc)(docRef);
18916
18946
  if (!docSnap.exists()) return null;
@@ -18936,6 +18966,7 @@ var CategoryService = class extends BaseService {
18936
18966
  const snapshot = await (0, import_firestore59.getDocs)(q);
18937
18967
  if (snapshot.empty) return null;
18938
18968
  const doc45 = snapshot.docs[0];
18969
+ if (doc45.id === EXCLUDED_CATEGORY_ID) return null;
18939
18970
  return {
18940
18971
  id: doc45.id,
18941
18972
  ...doc45.data()
@@ -18973,6 +19004,7 @@ var CategoryService = class extends BaseService {
18973
19004
  const snapshot = await (0, import_firestore59.getDocs)(q);
18974
19005
  if (snapshot.empty) break;
18975
19006
  for (const d of snapshot.docs) {
19007
+ if (d.id === EXCLUDED_CATEGORY_ID) continue;
18976
19008
  const category = { id: d.id, ...d.data() };
18977
19009
  rows.push(this.categoryToCsvRow(category));
18978
19010
  }
@@ -19015,7 +19047,16 @@ var import_firestore60 = require("firebase/firestore");
19015
19047
  var SUBCATEGORIES_COLLECTION = "subcategories";
19016
19048
 
19017
19049
  // src/backoffice/services/subcategory.service.ts
19050
+ var EXCLUDED_SUBCATEGORY_ID = "free-consultation";
19018
19051
  var SubcategoryService = class extends BaseService {
19052
+ /**
19053
+ * Filters out excluded subcategories from a list.
19054
+ * @param subcategories - List of subcategories to filter
19055
+ * @returns Filtered list without excluded subcategories
19056
+ */
19057
+ filterExcludedSubcategories(subcategories) {
19058
+ return subcategories.filter((sub) => sub.id !== EXCLUDED_SUBCATEGORY_ID);
19059
+ }
19019
19060
  /**
19020
19061
  * Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
19021
19062
  * @param categoryId - ID roditeljske kategorije
@@ -19062,8 +19103,9 @@ var SubcategoryService = class extends BaseService {
19062
19103
  const categoryId = categoryDoc.id;
19063
19104
  const subcategoriesRef = this.getSubcategoriesRef(categoryId);
19064
19105
  const q = (0, import_firestore60.query)(subcategoriesRef, (0, import_firestore60.where)("isActive", "==", active));
19065
- const snapshot = await (0, import_firestore60.getCountFromServer)(q);
19066
- counts[categoryId] = snapshot.data().count;
19106
+ const snapshot = await (0, import_firestore60.getDocs)(q);
19107
+ const filteredDocs = snapshot.docs.filter((doc45) => doc45.id !== EXCLUDED_SUBCATEGORY_ID);
19108
+ counts[categoryId] = filteredDocs.length;
19067
19109
  }
19068
19110
  return counts;
19069
19111
  }
@@ -19089,8 +19131,9 @@ var SubcategoryService = class extends BaseService {
19089
19131
  ...doc45.data()
19090
19132
  })
19091
19133
  );
19134
+ const filteredSubcategories = this.filterExcludedSubcategories(subcategories);
19092
19135
  const newLastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
19093
- return { subcategories, lastVisible: newLastVisible };
19136
+ return { subcategories: filteredSubcategories, lastVisible: newLastVisible };
19094
19137
  }
19095
19138
  /**
19096
19139
  * Vraća sve podkategorije sa paginacijom koristeći collection group query.
@@ -19119,8 +19162,9 @@ var SubcategoryService = class extends BaseService {
19119
19162
  ...doc45.data()
19120
19163
  })
19121
19164
  );
19165
+ const filteredSubcategories = this.filterExcludedSubcategories(subcategories);
19122
19166
  const newLastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
19123
- return { subcategories, lastVisible: newLastVisible };
19167
+ return { subcategories: filteredSubcategories, lastVisible: newLastVisible };
19124
19168
  }
19125
19169
  /**
19126
19170
  * Vraća sve subkategorije za određenu kategoriju za potrebe filtera (bez paginacije)
@@ -19133,12 +19177,13 @@ var SubcategoryService = class extends BaseService {
19133
19177
  (0, import_firestore60.where)("isActive", "==", true)
19134
19178
  );
19135
19179
  const querySnapshot = await (0, import_firestore60.getDocs)(q);
19136
- return querySnapshot.docs.map(
19180
+ const subcategories = querySnapshot.docs.map(
19137
19181
  (doc45) => ({
19138
19182
  id: doc45.id,
19139
19183
  ...doc45.data()
19140
19184
  })
19141
19185
  );
19186
+ return this.filterExcludedSubcategories(subcategories);
19142
19187
  }
19143
19188
  /**
19144
19189
  * Vraća sve subkategorije za potrebe filtera (bez paginacije)
@@ -19150,12 +19195,13 @@ var SubcategoryService = class extends BaseService {
19150
19195
  (0, import_firestore60.where)("isActive", "==", true)
19151
19196
  );
19152
19197
  const querySnapshot = await (0, import_firestore60.getDocs)(q);
19153
- return querySnapshot.docs.map(
19198
+ const subcategories = querySnapshot.docs.map(
19154
19199
  (doc45) => ({
19155
19200
  id: doc45.id,
19156
19201
  ...doc45.data()
19157
19202
  })
19158
19203
  );
19204
+ return this.filterExcludedSubcategories(subcategories);
19159
19205
  }
19160
19206
  /**
19161
19207
  * Ažurira postojeću podkategoriju
@@ -19225,6 +19271,23 @@ var SubcategoryService = class extends BaseService {
19225
19271
  * @returns Podkategorija ili null ako ne postoji
19226
19272
  */
19227
19273
  async getById(categoryId, subcategoryId) {
19274
+ if (subcategoryId === EXCLUDED_SUBCATEGORY_ID) return null;
19275
+ const docRef = (0, import_firestore60.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
19276
+ const docSnap = await (0, import_firestore60.getDoc)(docRef);
19277
+ if (!docSnap.exists()) return null;
19278
+ return {
19279
+ id: docSnap.id,
19280
+ ...docSnap.data()
19281
+ };
19282
+ }
19283
+ /**
19284
+ * Internal method to get subcategory by ID without filtering.
19285
+ * Used internally for consultation procedures.
19286
+ * @param categoryId - ID of the category
19287
+ * @param subcategoryId - ID of the subcategory to get
19288
+ * @returns Subcategory or null if not found
19289
+ */
19290
+ async getByIdInternal(categoryId, subcategoryId) {
19228
19291
  const docRef = (0, import_firestore60.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
19229
19292
  const docSnap = await (0, import_firestore60.getDoc)(docRef);
19230
19293
  if (!docSnap.exists()) return null;
@@ -19249,6 +19312,7 @@ var SubcategoryService = class extends BaseService {
19249
19312
  const querySnapshot = await (0, import_firestore60.getDocs)(q);
19250
19313
  if (querySnapshot.empty) return null;
19251
19314
  const doc45 = querySnapshot.docs[0];
19315
+ if (doc45.id === EXCLUDED_SUBCATEGORY_ID) return null;
19252
19316
  return {
19253
19317
  id: doc45.id,
19254
19318
  ...doc45.data()
@@ -19289,6 +19353,7 @@ var SubcategoryService = class extends BaseService {
19289
19353
  const snapshot = await (0, import_firestore60.getDocs)(q);
19290
19354
  if (snapshot.empty) break;
19291
19355
  for (const d of snapshot.docs) {
19356
+ if (d.id === EXCLUDED_SUBCATEGORY_ID) continue;
19292
19357
  const subcategory = { id: d.id, ...d.data() };
19293
19358
  rows.push(this.subcategoryToCsvRow(subcategory));
19294
19359
  }
@@ -19331,11 +19396,20 @@ var import_firestore61 = require("firebase/firestore");
19331
19396
  var PRODUCTS_COLLECTION = "products";
19332
19397
 
19333
19398
  // src/backoffice/services/technology.service.ts
19399
+ var EXCLUDED_TECHNOLOGY_ID = "free-consultation-tech";
19334
19400
  var DEFAULT_CERTIFICATION_REQUIREMENT = {
19335
19401
  minimumLevel: "aesthetician" /* AESTHETICIAN */,
19336
19402
  requiredSpecialties: []
19337
19403
  };
19338
19404
  var TechnologyService = class extends BaseService {
19405
+ /**
19406
+ * Filters out excluded technologies from a list.
19407
+ * @param technologies - List of technologies to filter
19408
+ * @returns Filtered list without excluded technologies
19409
+ */
19410
+ filterExcludedTechnologies(technologies) {
19411
+ return technologies.filter((tech) => tech.id !== EXCLUDED_TECHNOLOGY_ID);
19412
+ }
19339
19413
  /**
19340
19414
  * Reference to the Firestore collection of technologies.
19341
19415
  */
@@ -19384,6 +19458,7 @@ var TechnologyService = class extends BaseService {
19384
19458
  const snapshot = await (0, import_firestore61.getDocs)(q);
19385
19459
  const counts = {};
19386
19460
  snapshot.docs.forEach((doc45) => {
19461
+ if (doc45.id === EXCLUDED_TECHNOLOGY_ID) return;
19387
19462
  const tech = doc45.data();
19388
19463
  counts[tech.subcategoryId] = (counts[tech.subcategoryId] || 0) + 1;
19389
19464
  });
@@ -19399,6 +19474,7 @@ var TechnologyService = class extends BaseService {
19399
19474
  const snapshot = await (0, import_firestore61.getDocs)(q);
19400
19475
  const counts = {};
19401
19476
  snapshot.docs.forEach((doc45) => {
19477
+ if (doc45.id === EXCLUDED_TECHNOLOGY_ID) return;
19402
19478
  const tech = doc45.data();
19403
19479
  counts[tech.categoryId] = (counts[tech.categoryId] || 0) + 1;
19404
19480
  });
@@ -19425,8 +19501,9 @@ var TechnologyService = class extends BaseService {
19425
19501
  ...doc45.data()
19426
19502
  })
19427
19503
  );
19504
+ const filteredTechnologies = this.filterExcludedTechnologies(technologies);
19428
19505
  const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
19429
- return { technologies, lastVisible: newLastVisible };
19506
+ return { technologies: filteredTechnologies, lastVisible: newLastVisible };
19430
19507
  }
19431
19508
  /**
19432
19509
  * Returns all technologies for a specific category with pagination.
@@ -19451,8 +19528,9 @@ var TechnologyService = class extends BaseService {
19451
19528
  ...doc45.data()
19452
19529
  })
19453
19530
  );
19531
+ const filteredTechnologies = this.filterExcludedTechnologies(technologies);
19454
19532
  const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
19455
- return { technologies, lastVisible: newLastVisible };
19533
+ return { technologies: filteredTechnologies, lastVisible: newLastVisible };
19456
19534
  }
19457
19535
  /**
19458
19536
  * Returns all technologies for a specific subcategory with pagination.
@@ -19477,8 +19555,9 @@ var TechnologyService = class extends BaseService {
19477
19555
  ...doc45.data()
19478
19556
  })
19479
19557
  );
19558
+ const filteredTechnologies = this.filterExcludedTechnologies(technologies);
19480
19559
  const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
19481
- return { technologies, lastVisible: newLastVisible };
19560
+ return { technologies: filteredTechnologies, lastVisible: newLastVisible };
19482
19561
  }
19483
19562
  /**
19484
19563
  * Updates an existing technology.
@@ -19536,6 +19615,22 @@ var TechnologyService = class extends BaseService {
19536
19615
  * @returns The technology or null if it doesn't exist.
19537
19616
  */
19538
19617
  async getById(id) {
19618
+ if (id === EXCLUDED_TECHNOLOGY_ID) return null;
19619
+ const docRef = (0, import_firestore61.doc)(this.technologiesRef, id);
19620
+ const docSnap = await (0, import_firestore61.getDoc)(docRef);
19621
+ if (!docSnap.exists()) return null;
19622
+ return {
19623
+ id: docSnap.id,
19624
+ ...docSnap.data()
19625
+ };
19626
+ }
19627
+ /**
19628
+ * Internal method to get technology by ID without filtering.
19629
+ * Used internally for consultation procedures.
19630
+ * @param id - The ID of the requested technology
19631
+ * @returns The technology or null if it doesn't exist
19632
+ */
19633
+ async getByIdInternal(id) {
19539
19634
  const docRef = (0, import_firestore61.doc)(this.technologiesRef, id);
19540
19635
  const docSnap = await (0, import_firestore61.getDoc)(docRef);
19541
19636
  if (!docSnap.exists()) return null;
@@ -19559,6 +19654,7 @@ var TechnologyService = class extends BaseService {
19559
19654
  const snapshot = await (0, import_firestore61.getDocs)(q);
19560
19655
  if (snapshot.empty) return null;
19561
19656
  const doc45 = snapshot.docs[0];
19657
+ if (doc45.id === EXCLUDED_TECHNOLOGY_ID) return null;
19562
19658
  return {
19563
19659
  id: doc45.id,
19564
19660
  ...doc45.data()
@@ -19924,12 +20020,13 @@ var TechnologyService = class extends BaseService {
19924
20020
  (0, import_firestore61.orderBy)("name")
19925
20021
  );
19926
20022
  const snapshot = await (0, import_firestore61.getDocs)(q);
19927
- return snapshot.docs.map(
20023
+ const technologies = snapshot.docs.map(
19928
20024
  (doc45) => ({
19929
20025
  id: doc45.id,
19930
20026
  ...doc45.data()
19931
20027
  })
19932
20028
  );
20029
+ return this.filterExcludedTechnologies(technologies);
19933
20030
  }
19934
20031
  /**
19935
20032
  * Gets all active technologies for a subcategory for filter dropdowns.
@@ -19945,12 +20042,13 @@ var TechnologyService = class extends BaseService {
19945
20042
  (0, import_firestore61.orderBy)("name")
19946
20043
  );
19947
20044
  const snapshot = await (0, import_firestore61.getDocs)(q);
19948
- return snapshot.docs.map(
20045
+ const technologies = snapshot.docs.map(
19949
20046
  (doc45) => ({
19950
20047
  id: doc45.id,
19951
20048
  ...doc45.data()
19952
20049
  })
19953
20050
  );
20051
+ return this.filterExcludedTechnologies(technologies);
19954
20052
  }
19955
20053
  /**
19956
20054
  * Gets all active technologies for filter dropdowns.
@@ -19962,12 +20060,13 @@ var TechnologyService = class extends BaseService {
19962
20060
  (0, import_firestore61.orderBy)("name")
19963
20061
  );
19964
20062
  const snapshot = await (0, import_firestore61.getDocs)(q);
19965
- return snapshot.docs.map(
20063
+ const technologies = snapshot.docs.map(
19966
20064
  (doc45) => ({
19967
20065
  id: doc45.id,
19968
20066
  ...doc45.data()
19969
20067
  })
19970
20068
  );
20069
+ return this.filterExcludedTechnologies(technologies);
19971
20070
  }
19972
20071
  // ==========================================
19973
20072
  // NEW METHODS: Product assignment management
@@ -20133,6 +20232,7 @@ var TechnologyService = class extends BaseService {
20133
20232
  const snapshot = await (0, import_firestore61.getDocs)(q);
20134
20233
  if (snapshot.empty) break;
20135
20234
  for (const d of snapshot.docs) {
20235
+ if (d.id === EXCLUDED_TECHNOLOGY_ID) continue;
20136
20236
  const technology = { id: d.id, ...d.data() };
20137
20237
  const productNames = await this.getProductNamesForTechnology(technology.id);
20138
20238
  rows.push(this.technologyToCsvRow(technology, productNames));