@blackcode_sa/metaestetics-api 1.12.66 → 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/backoffice/index.d.mts +73 -0
- package/dist/backoffice/index.d.ts +73 -0
- package/dist/backoffice/index.js +181 -18
- package/dist/backoffice/index.mjs +181 -20
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +184 -21
- package/dist/index.mjs +184 -23
- package/package.json +1 -1
- package/src/backoffice/services/category.service.ts +72 -6
- package/src/backoffice/services/subcategory.service.ts +72 -6
- package/src/backoffice/services/technology.service.ts +74 -6
- package/src/backoffice/types/category.types.ts +5 -0
- package/src/backoffice/types/technology.types.ts +5 -0
- package/src/services/procedure/procedure.service.ts +3 -3
package/dist/backoffice/index.js
CHANGED
|
@@ -346,7 +346,16 @@ var ProcedureFamily = /* @__PURE__ */ ((ProcedureFamily2) => {
|
|
|
346
346
|
})(ProcedureFamily || {});
|
|
347
347
|
|
|
348
348
|
// src/backoffice/services/category.service.ts
|
|
349
|
+
var EXCLUDED_CATEGORY_ID = "consultation";
|
|
349
350
|
var CategoryService = class extends BaseService {
|
|
351
|
+
/**
|
|
352
|
+
* Filters out excluded categories from a list.
|
|
353
|
+
* @param categories - List of categories to filter
|
|
354
|
+
* @returns Filtered list without excluded categories
|
|
355
|
+
*/
|
|
356
|
+
filterExcludedCategories(categories) {
|
|
357
|
+
return categories.filter((cat) => cat.id !== EXCLUDED_CATEGORY_ID);
|
|
358
|
+
}
|
|
350
359
|
/**
|
|
351
360
|
* Referenca na Firestore kolekciju kategorija
|
|
352
361
|
*/
|
|
@@ -383,8 +392,9 @@ var CategoryService = class extends BaseService {
|
|
|
383
392
|
(0, import_firestore2.where)("family", "==", family),
|
|
384
393
|
(0, import_firestore2.where)("isActive", "==", active)
|
|
385
394
|
);
|
|
386
|
-
const snapshot = await (0, import_firestore2.
|
|
387
|
-
|
|
395
|
+
const snapshot = await (0, import_firestore2.getDocs)(q);
|
|
396
|
+
const filteredDocs = snapshot.docs.filter((doc11) => doc11.id !== EXCLUDED_CATEGORY_ID);
|
|
397
|
+
counts[family] = filteredDocs.length;
|
|
388
398
|
}
|
|
389
399
|
return counts;
|
|
390
400
|
}
|
|
@@ -395,12 +405,13 @@ var CategoryService = class extends BaseService {
|
|
|
395
405
|
async getAllForFilter() {
|
|
396
406
|
const q = (0, import_firestore2.query)(this.categoriesRef, (0, import_firestore2.where)("isActive", "==", true));
|
|
397
407
|
const snapshot = await (0, import_firestore2.getDocs)(q);
|
|
398
|
-
|
|
408
|
+
const categories = snapshot.docs.map(
|
|
399
409
|
(doc11) => ({
|
|
400
410
|
id: doc11.id,
|
|
401
411
|
...doc11.data()
|
|
402
412
|
})
|
|
403
413
|
);
|
|
414
|
+
return this.filterExcludedCategories(categories);
|
|
404
415
|
}
|
|
405
416
|
/**
|
|
406
417
|
* Vraća sve kategorije za određenu familiju za potrebe filtera (bez paginacije)
|
|
@@ -415,12 +426,13 @@ var CategoryService = class extends BaseService {
|
|
|
415
426
|
(0, import_firestore2.orderBy)("name")
|
|
416
427
|
);
|
|
417
428
|
const snapshot = await (0, import_firestore2.getDocs)(q);
|
|
418
|
-
|
|
429
|
+
const categories = snapshot.docs.map(
|
|
419
430
|
(doc11) => ({
|
|
420
431
|
id: doc11.id,
|
|
421
432
|
...doc11.data()
|
|
422
433
|
})
|
|
423
434
|
);
|
|
435
|
+
return this.filterExcludedCategories(categories);
|
|
424
436
|
}
|
|
425
437
|
/**
|
|
426
438
|
* Vraća sve kategorije sa paginacijom
|
|
@@ -443,8 +455,9 @@ var CategoryService = class extends BaseService {
|
|
|
443
455
|
...doc11.data()
|
|
444
456
|
})
|
|
445
457
|
);
|
|
458
|
+
const filteredCategories = this.filterExcludedCategories(categories);
|
|
446
459
|
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
447
|
-
return { categories, lastVisible: newLastVisible };
|
|
460
|
+
return { categories: filteredCategories, lastVisible: newLastVisible };
|
|
448
461
|
}
|
|
449
462
|
/**
|
|
450
463
|
* Vraća sve aktivne kategorije za određenu familiju procedura sa paginacijom
|
|
@@ -469,8 +482,9 @@ var CategoryService = class extends BaseService {
|
|
|
469
482
|
...doc11.data()
|
|
470
483
|
})
|
|
471
484
|
);
|
|
485
|
+
const filteredCategories = this.filterExcludedCategories(categories);
|
|
472
486
|
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
473
|
-
return { categories, lastVisible: newLastVisible };
|
|
487
|
+
return { categories: filteredCategories, lastVisible: newLastVisible };
|
|
474
488
|
}
|
|
475
489
|
/**
|
|
476
490
|
* Ažurira postojeću kategoriju
|
|
@@ -507,6 +521,7 @@ var CategoryService = class extends BaseService {
|
|
|
507
521
|
* @returns Kategorija ili null ako ne postoji
|
|
508
522
|
*/
|
|
509
523
|
async getById(id) {
|
|
524
|
+
if (id === EXCLUDED_CATEGORY_ID) return null;
|
|
510
525
|
const docRef = (0, import_firestore2.doc)(this.categoriesRef, id);
|
|
511
526
|
const docSnap = await (0, import_firestore2.getDoc)(docRef);
|
|
512
527
|
if (!docSnap.exists()) return null;
|
|
@@ -515,6 +530,44 @@ var CategoryService = class extends BaseService {
|
|
|
515
530
|
...docSnap.data()
|
|
516
531
|
};
|
|
517
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* Internal method to get category by ID without filtering.
|
|
535
|
+
* Used internally for consultation procedures.
|
|
536
|
+
* @param id - ID of the category to get
|
|
537
|
+
* @returns Category or null if not found
|
|
538
|
+
*/
|
|
539
|
+
async getByIdInternal(id) {
|
|
540
|
+
const docRef = (0, import_firestore2.doc)(this.categoriesRef, id);
|
|
541
|
+
const docSnap = await (0, import_firestore2.getDoc)(docRef);
|
|
542
|
+
if (!docSnap.exists()) return null;
|
|
543
|
+
return {
|
|
544
|
+
id: docSnap.id,
|
|
545
|
+
...docSnap.data()
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Finds a category by exact name match within a specific family.
|
|
550
|
+
* Used for CSV import matching.
|
|
551
|
+
* @param name - Exact name of the category to find
|
|
552
|
+
* @param family - Procedure family to search within
|
|
553
|
+
* @returns Category if found, null otherwise
|
|
554
|
+
*/
|
|
555
|
+
async findByNameAndFamily(name, family) {
|
|
556
|
+
const q = (0, import_firestore2.query)(
|
|
557
|
+
this.categoriesRef,
|
|
558
|
+
(0, import_firestore2.where)("name", "==", name),
|
|
559
|
+
(0, import_firestore2.where)("family", "==", family),
|
|
560
|
+
(0, import_firestore2.where)("isActive", "==", true)
|
|
561
|
+
);
|
|
562
|
+
const snapshot = await (0, import_firestore2.getDocs)(q);
|
|
563
|
+
if (snapshot.empty) return null;
|
|
564
|
+
const doc11 = snapshot.docs[0];
|
|
565
|
+
if (doc11.id === EXCLUDED_CATEGORY_ID) return null;
|
|
566
|
+
return {
|
|
567
|
+
id: doc11.id,
|
|
568
|
+
...doc11.data()
|
|
569
|
+
};
|
|
570
|
+
}
|
|
518
571
|
/**
|
|
519
572
|
* Exports categories to CSV string, suitable for Excel/Sheets.
|
|
520
573
|
* Includes headers and optional UTF-8 BOM.
|
|
@@ -547,6 +600,7 @@ var CategoryService = class extends BaseService {
|
|
|
547
600
|
const snapshot = await (0, import_firestore2.getDocs)(q);
|
|
548
601
|
if (snapshot.empty) break;
|
|
549
602
|
for (const d of snapshot.docs) {
|
|
603
|
+
if (d.id === EXCLUDED_CATEGORY_ID) continue;
|
|
550
604
|
const category = { id: d.id, ...d.data() };
|
|
551
605
|
rows.push(this.categoryToCsvRow(category));
|
|
552
606
|
}
|
|
@@ -2227,7 +2281,16 @@ var import_firestore10 = require("firebase/firestore");
|
|
|
2227
2281
|
var SUBCATEGORIES_COLLECTION = "subcategories";
|
|
2228
2282
|
|
|
2229
2283
|
// src/backoffice/services/subcategory.service.ts
|
|
2284
|
+
var EXCLUDED_SUBCATEGORY_ID = "free-consultation";
|
|
2230
2285
|
var SubcategoryService = class extends BaseService {
|
|
2286
|
+
/**
|
|
2287
|
+
* Filters out excluded subcategories from a list.
|
|
2288
|
+
* @param subcategories - List of subcategories to filter
|
|
2289
|
+
* @returns Filtered list without excluded subcategories
|
|
2290
|
+
*/
|
|
2291
|
+
filterExcludedSubcategories(subcategories) {
|
|
2292
|
+
return subcategories.filter((sub) => sub.id !== EXCLUDED_SUBCATEGORY_ID);
|
|
2293
|
+
}
|
|
2231
2294
|
/**
|
|
2232
2295
|
* Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
|
|
2233
2296
|
* @param categoryId - ID roditeljske kategorije
|
|
@@ -2274,8 +2337,9 @@ var SubcategoryService = class extends BaseService {
|
|
|
2274
2337
|
const categoryId = categoryDoc.id;
|
|
2275
2338
|
const subcategoriesRef = this.getSubcategoriesRef(categoryId);
|
|
2276
2339
|
const q = (0, import_firestore10.query)(subcategoriesRef, (0, import_firestore10.where)("isActive", "==", active));
|
|
2277
|
-
const snapshot = await (0, import_firestore10.
|
|
2278
|
-
|
|
2340
|
+
const snapshot = await (0, import_firestore10.getDocs)(q);
|
|
2341
|
+
const filteredDocs = snapshot.docs.filter((doc11) => doc11.id !== EXCLUDED_SUBCATEGORY_ID);
|
|
2342
|
+
counts[categoryId] = filteredDocs.length;
|
|
2279
2343
|
}
|
|
2280
2344
|
return counts;
|
|
2281
2345
|
}
|
|
@@ -2301,8 +2365,9 @@ var SubcategoryService = class extends BaseService {
|
|
|
2301
2365
|
...doc11.data()
|
|
2302
2366
|
})
|
|
2303
2367
|
);
|
|
2368
|
+
const filteredSubcategories = this.filterExcludedSubcategories(subcategories);
|
|
2304
2369
|
const newLastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
|
|
2305
|
-
return { subcategories, lastVisible: newLastVisible };
|
|
2370
|
+
return { subcategories: filteredSubcategories, lastVisible: newLastVisible };
|
|
2306
2371
|
}
|
|
2307
2372
|
/**
|
|
2308
2373
|
* Vraća sve podkategorije sa paginacijom koristeći collection group query.
|
|
@@ -2331,8 +2396,9 @@ var SubcategoryService = class extends BaseService {
|
|
|
2331
2396
|
...doc11.data()
|
|
2332
2397
|
})
|
|
2333
2398
|
);
|
|
2399
|
+
const filteredSubcategories = this.filterExcludedSubcategories(subcategories);
|
|
2334
2400
|
const newLastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
|
|
2335
|
-
return { subcategories, lastVisible: newLastVisible };
|
|
2401
|
+
return { subcategories: filteredSubcategories, lastVisible: newLastVisible };
|
|
2336
2402
|
}
|
|
2337
2403
|
/**
|
|
2338
2404
|
* Vraća sve subkategorije za određenu kategoriju za potrebe filtera (bez paginacije)
|
|
@@ -2345,12 +2411,13 @@ var SubcategoryService = class extends BaseService {
|
|
|
2345
2411
|
(0, import_firestore10.where)("isActive", "==", true)
|
|
2346
2412
|
);
|
|
2347
2413
|
const querySnapshot = await (0, import_firestore10.getDocs)(q);
|
|
2348
|
-
|
|
2414
|
+
const subcategories = querySnapshot.docs.map(
|
|
2349
2415
|
(doc11) => ({
|
|
2350
2416
|
id: doc11.id,
|
|
2351
2417
|
...doc11.data()
|
|
2352
2418
|
})
|
|
2353
2419
|
);
|
|
2420
|
+
return this.filterExcludedSubcategories(subcategories);
|
|
2354
2421
|
}
|
|
2355
2422
|
/**
|
|
2356
2423
|
* Vraća sve subkategorije za potrebe filtera (bez paginacije)
|
|
@@ -2362,12 +2429,13 @@ var SubcategoryService = class extends BaseService {
|
|
|
2362
2429
|
(0, import_firestore10.where)("isActive", "==", true)
|
|
2363
2430
|
);
|
|
2364
2431
|
const querySnapshot = await (0, import_firestore10.getDocs)(q);
|
|
2365
|
-
|
|
2432
|
+
const subcategories = querySnapshot.docs.map(
|
|
2366
2433
|
(doc11) => ({
|
|
2367
2434
|
id: doc11.id,
|
|
2368
2435
|
...doc11.data()
|
|
2369
2436
|
})
|
|
2370
2437
|
);
|
|
2438
|
+
return this.filterExcludedSubcategories(subcategories);
|
|
2371
2439
|
}
|
|
2372
2440
|
/**
|
|
2373
2441
|
* Ažurira postojeću podkategoriju
|
|
@@ -2437,6 +2505,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
2437
2505
|
* @returns Podkategorija ili null ako ne postoji
|
|
2438
2506
|
*/
|
|
2439
2507
|
async getById(categoryId, subcategoryId) {
|
|
2508
|
+
if (subcategoryId === EXCLUDED_SUBCATEGORY_ID) return null;
|
|
2440
2509
|
const docRef = (0, import_firestore10.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
2441
2510
|
const docSnap = await (0, import_firestore10.getDoc)(docRef);
|
|
2442
2511
|
if (!docSnap.exists()) return null;
|
|
@@ -2445,6 +2514,44 @@ var SubcategoryService = class extends BaseService {
|
|
|
2445
2514
|
...docSnap.data()
|
|
2446
2515
|
};
|
|
2447
2516
|
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Internal method to get subcategory by ID without filtering.
|
|
2519
|
+
* Used internally for consultation procedures.
|
|
2520
|
+
* @param categoryId - ID of the category
|
|
2521
|
+
* @param subcategoryId - ID of the subcategory to get
|
|
2522
|
+
* @returns Subcategory or null if not found
|
|
2523
|
+
*/
|
|
2524
|
+
async getByIdInternal(categoryId, subcategoryId) {
|
|
2525
|
+
const docRef = (0, import_firestore10.doc)(this.getSubcategoriesRef(categoryId), subcategoryId);
|
|
2526
|
+
const docSnap = await (0, import_firestore10.getDoc)(docRef);
|
|
2527
|
+
if (!docSnap.exists()) return null;
|
|
2528
|
+
return {
|
|
2529
|
+
id: docSnap.id,
|
|
2530
|
+
...docSnap.data()
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Finds a subcategory by exact name match within a specific category.
|
|
2535
|
+
* Used for CSV import matching.
|
|
2536
|
+
* @param name - Exact name of the subcategory to find
|
|
2537
|
+
* @param categoryId - ID of the category to search within
|
|
2538
|
+
* @returns Subcategory if found, null otherwise
|
|
2539
|
+
*/
|
|
2540
|
+
async findByNameAndCategory(name, categoryId) {
|
|
2541
|
+
const q = (0, import_firestore10.query)(
|
|
2542
|
+
this.getSubcategoriesRef(categoryId),
|
|
2543
|
+
(0, import_firestore10.where)("name", "==", name),
|
|
2544
|
+
(0, import_firestore10.where)("isActive", "==", true)
|
|
2545
|
+
);
|
|
2546
|
+
const querySnapshot = await (0, import_firestore10.getDocs)(q);
|
|
2547
|
+
if (querySnapshot.empty) return null;
|
|
2548
|
+
const doc11 = querySnapshot.docs[0];
|
|
2549
|
+
if (doc11.id === EXCLUDED_SUBCATEGORY_ID) return null;
|
|
2550
|
+
return {
|
|
2551
|
+
id: doc11.id,
|
|
2552
|
+
...doc11.data()
|
|
2553
|
+
};
|
|
2554
|
+
}
|
|
2448
2555
|
/**
|
|
2449
2556
|
* Exports subcategories to CSV string, suitable for Excel/Sheets.
|
|
2450
2557
|
* Includes headers and optional UTF-8 BOM.
|
|
@@ -2480,6 +2587,7 @@ var SubcategoryService = class extends BaseService {
|
|
|
2480
2587
|
const snapshot = await (0, import_firestore10.getDocs)(q);
|
|
2481
2588
|
if (snapshot.empty) break;
|
|
2482
2589
|
for (const d of snapshot.docs) {
|
|
2590
|
+
if (d.id === EXCLUDED_SUBCATEGORY_ID) continue;
|
|
2483
2591
|
const subcategory = { id: d.id, ...d.data() };
|
|
2484
2592
|
rows.push(this.subcategoryToCsvRow(subcategory));
|
|
2485
2593
|
}
|
|
@@ -2543,11 +2651,20 @@ var CertificationSpecialty = /* @__PURE__ */ ((CertificationSpecialty3) => {
|
|
|
2543
2651
|
})(CertificationSpecialty || {});
|
|
2544
2652
|
|
|
2545
2653
|
// src/backoffice/services/technology.service.ts
|
|
2654
|
+
var EXCLUDED_TECHNOLOGY_ID = "free-consultation-tech";
|
|
2546
2655
|
var DEFAULT_CERTIFICATION_REQUIREMENT = {
|
|
2547
2656
|
minimumLevel: "aesthetician" /* AESTHETICIAN */,
|
|
2548
2657
|
requiredSpecialties: []
|
|
2549
2658
|
};
|
|
2550
2659
|
var TechnologyService = class extends BaseService {
|
|
2660
|
+
/**
|
|
2661
|
+
* Filters out excluded technologies from a list.
|
|
2662
|
+
* @param technologies - List of technologies to filter
|
|
2663
|
+
* @returns Filtered list without excluded technologies
|
|
2664
|
+
*/
|
|
2665
|
+
filterExcludedTechnologies(technologies) {
|
|
2666
|
+
return technologies.filter((tech) => tech.id !== EXCLUDED_TECHNOLOGY_ID);
|
|
2667
|
+
}
|
|
2551
2668
|
/**
|
|
2552
2669
|
* Reference to the Firestore collection of technologies.
|
|
2553
2670
|
*/
|
|
@@ -2596,6 +2713,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2596
2713
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
2597
2714
|
const counts = {};
|
|
2598
2715
|
snapshot.docs.forEach((doc11) => {
|
|
2716
|
+
if (doc11.id === EXCLUDED_TECHNOLOGY_ID) return;
|
|
2599
2717
|
const tech = doc11.data();
|
|
2600
2718
|
counts[tech.subcategoryId] = (counts[tech.subcategoryId] || 0) + 1;
|
|
2601
2719
|
});
|
|
@@ -2611,6 +2729,7 @@ var TechnologyService = class extends BaseService {
|
|
|
2611
2729
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
2612
2730
|
const counts = {};
|
|
2613
2731
|
snapshot.docs.forEach((doc11) => {
|
|
2732
|
+
if (doc11.id === EXCLUDED_TECHNOLOGY_ID) return;
|
|
2614
2733
|
const tech = doc11.data();
|
|
2615
2734
|
counts[tech.categoryId] = (counts[tech.categoryId] || 0) + 1;
|
|
2616
2735
|
});
|
|
@@ -2637,8 +2756,9 @@ var TechnologyService = class extends BaseService {
|
|
|
2637
2756
|
...doc11.data()
|
|
2638
2757
|
})
|
|
2639
2758
|
);
|
|
2759
|
+
const filteredTechnologies = this.filterExcludedTechnologies(technologies);
|
|
2640
2760
|
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
2641
|
-
return { technologies, lastVisible: newLastVisible };
|
|
2761
|
+
return { technologies: filteredTechnologies, lastVisible: newLastVisible };
|
|
2642
2762
|
}
|
|
2643
2763
|
/**
|
|
2644
2764
|
* Returns all technologies for a specific category with pagination.
|
|
@@ -2663,8 +2783,9 @@ var TechnologyService = class extends BaseService {
|
|
|
2663
2783
|
...doc11.data()
|
|
2664
2784
|
})
|
|
2665
2785
|
);
|
|
2786
|
+
const filteredTechnologies = this.filterExcludedTechnologies(technologies);
|
|
2666
2787
|
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
2667
|
-
return { technologies, lastVisible: newLastVisible };
|
|
2788
|
+
return { technologies: filteredTechnologies, lastVisible: newLastVisible };
|
|
2668
2789
|
}
|
|
2669
2790
|
/**
|
|
2670
2791
|
* Returns all technologies for a specific subcategory with pagination.
|
|
@@ -2689,8 +2810,9 @@ var TechnologyService = class extends BaseService {
|
|
|
2689
2810
|
...doc11.data()
|
|
2690
2811
|
})
|
|
2691
2812
|
);
|
|
2813
|
+
const filteredTechnologies = this.filterExcludedTechnologies(technologies);
|
|
2692
2814
|
const newLastVisible = snapshot.docs[snapshot.docs.length - 1];
|
|
2693
|
-
return { technologies, lastVisible: newLastVisible };
|
|
2815
|
+
return { technologies: filteredTechnologies, lastVisible: newLastVisible };
|
|
2694
2816
|
}
|
|
2695
2817
|
/**
|
|
2696
2818
|
* Updates an existing technology.
|
|
@@ -2748,6 +2870,22 @@ var TechnologyService = class extends BaseService {
|
|
|
2748
2870
|
* @returns The technology or null if it doesn't exist.
|
|
2749
2871
|
*/
|
|
2750
2872
|
async getById(id) {
|
|
2873
|
+
if (id === EXCLUDED_TECHNOLOGY_ID) return null;
|
|
2874
|
+
const docRef = (0, import_firestore11.doc)(this.technologiesRef, id);
|
|
2875
|
+
const docSnap = await (0, import_firestore11.getDoc)(docRef);
|
|
2876
|
+
if (!docSnap.exists()) return null;
|
|
2877
|
+
return {
|
|
2878
|
+
id: docSnap.id,
|
|
2879
|
+
...docSnap.data()
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Internal method to get technology by ID without filtering.
|
|
2884
|
+
* Used internally for consultation procedures.
|
|
2885
|
+
* @param id - The ID of the requested technology
|
|
2886
|
+
* @returns The technology or null if it doesn't exist
|
|
2887
|
+
*/
|
|
2888
|
+
async getByIdInternal(id) {
|
|
2751
2889
|
const docRef = (0, import_firestore11.doc)(this.technologiesRef, id);
|
|
2752
2890
|
const docSnap = await (0, import_firestore11.getDoc)(docRef);
|
|
2753
2891
|
if (!docSnap.exists()) return null;
|
|
@@ -2756,6 +2894,27 @@ var TechnologyService = class extends BaseService {
|
|
|
2756
2894
|
...docSnap.data()
|
|
2757
2895
|
};
|
|
2758
2896
|
}
|
|
2897
|
+
/**
|
|
2898
|
+
* Finds a technology by exact name match.
|
|
2899
|
+
* Used for CSV import duplicate detection.
|
|
2900
|
+
* @param name - Exact name of the technology to find
|
|
2901
|
+
* @returns Technology if found, null otherwise
|
|
2902
|
+
*/
|
|
2903
|
+
async findByName(name) {
|
|
2904
|
+
const q = (0, import_firestore11.query)(
|
|
2905
|
+
this.technologiesRef,
|
|
2906
|
+
(0, import_firestore11.where)("name", "==", name),
|
|
2907
|
+
(0, import_firestore11.where)("isActive", "==", true)
|
|
2908
|
+
);
|
|
2909
|
+
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
2910
|
+
if (snapshot.empty) return null;
|
|
2911
|
+
const doc11 = snapshot.docs[0];
|
|
2912
|
+
if (doc11.id === EXCLUDED_TECHNOLOGY_ID) return null;
|
|
2913
|
+
return {
|
|
2914
|
+
id: doc11.id,
|
|
2915
|
+
...doc11.data()
|
|
2916
|
+
};
|
|
2917
|
+
}
|
|
2759
2918
|
/**
|
|
2760
2919
|
* Dodaje novi zahtev tehnologiji
|
|
2761
2920
|
* @param technologyId - ID tehnologije
|
|
@@ -3116,12 +3275,13 @@ var TechnologyService = class extends BaseService {
|
|
|
3116
3275
|
(0, import_firestore11.orderBy)("name")
|
|
3117
3276
|
);
|
|
3118
3277
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
3119
|
-
|
|
3278
|
+
const technologies = snapshot.docs.map(
|
|
3120
3279
|
(doc11) => ({
|
|
3121
3280
|
id: doc11.id,
|
|
3122
3281
|
...doc11.data()
|
|
3123
3282
|
})
|
|
3124
3283
|
);
|
|
3284
|
+
return this.filterExcludedTechnologies(technologies);
|
|
3125
3285
|
}
|
|
3126
3286
|
/**
|
|
3127
3287
|
* Gets all active technologies for a subcategory for filter dropdowns.
|
|
@@ -3137,12 +3297,13 @@ var TechnologyService = class extends BaseService {
|
|
|
3137
3297
|
(0, import_firestore11.orderBy)("name")
|
|
3138
3298
|
);
|
|
3139
3299
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
3140
|
-
|
|
3300
|
+
const technologies = snapshot.docs.map(
|
|
3141
3301
|
(doc11) => ({
|
|
3142
3302
|
id: doc11.id,
|
|
3143
3303
|
...doc11.data()
|
|
3144
3304
|
})
|
|
3145
3305
|
);
|
|
3306
|
+
return this.filterExcludedTechnologies(technologies);
|
|
3146
3307
|
}
|
|
3147
3308
|
/**
|
|
3148
3309
|
* Gets all active technologies for filter dropdowns.
|
|
@@ -3154,12 +3315,13 @@ var TechnologyService = class extends BaseService {
|
|
|
3154
3315
|
(0, import_firestore11.orderBy)("name")
|
|
3155
3316
|
);
|
|
3156
3317
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
3157
|
-
|
|
3318
|
+
const technologies = snapshot.docs.map(
|
|
3158
3319
|
(doc11) => ({
|
|
3159
3320
|
id: doc11.id,
|
|
3160
3321
|
...doc11.data()
|
|
3161
3322
|
})
|
|
3162
3323
|
);
|
|
3324
|
+
return this.filterExcludedTechnologies(technologies);
|
|
3163
3325
|
}
|
|
3164
3326
|
// ==========================================
|
|
3165
3327
|
// NEW METHODS: Product assignment management
|
|
@@ -3325,6 +3487,7 @@ var TechnologyService = class extends BaseService {
|
|
|
3325
3487
|
const snapshot = await (0, import_firestore11.getDocs)(q);
|
|
3326
3488
|
if (snapshot.empty) break;
|
|
3327
3489
|
for (const d of snapshot.docs) {
|
|
3490
|
+
if (d.id === EXCLUDED_TECHNOLOGY_ID) continue;
|
|
3328
3491
|
const technology = { id: d.id, ...d.data() };
|
|
3329
3492
|
const productNames = await this.getProductNamesForTechnology(technology.id);
|
|
3330
3493
|
rows.push(this.technologyToCsvRow(technology, productNames));
|