@blackcode_sa/metaestetics-api 1.12.42 → 1.12.45
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/admin/index.d.mts +6 -12
- package/dist/admin/index.d.ts +6 -12
- package/dist/backoffice/index.d.mts +18 -182
- package/dist/backoffice/index.d.ts +18 -182
- package/dist/backoffice/index.js +14 -302
- package/dist/backoffice/index.mjs +27 -318
- package/dist/index.d.mts +10 -174
- package/dist/index.d.ts +10 -174
- package/dist/index.js +32 -309
- package/dist/index.mjs +40 -320
- package/package.json +1 -1
- package/src/backoffice/services/product.service.ts +18 -216
- package/src/backoffice/services/technology.service.ts +0 -169
- package/src/backoffice/types/product.types.ts +6 -116
- package/src/services/appointment/utils/zone-management.utils.ts +17 -3
- package/src/backoffice/services/migrate-products.ts +0 -116
package/dist/index.d.mts
CHANGED
|
@@ -565,10 +565,9 @@ interface FilledDocumentFileValue {
|
|
|
565
565
|
*
|
|
566
566
|
* @property id - Unique identifier of the product
|
|
567
567
|
* @property name - Name of the product
|
|
568
|
-
* @property brandId - ID of the brand that manufactures this product
|
|
569
|
-
* @property brandName - Name of the brand (denormalized for display)
|
|
570
|
-
* @property assignedTechnologyIds - Array of technology IDs this product is assigned to
|
|
571
568
|
* @property description - Detailed description of the product and its purpose
|
|
569
|
+
* @property brandId - ID of the brand that manufactures this product
|
|
570
|
+
* @property technologyId - ID of the technology this product is used with
|
|
572
571
|
* @property technicalDetails - Technical details and specifications
|
|
573
572
|
* @property warnings - List of warnings related to product use
|
|
574
573
|
* @property dosage - Dosage information (if applicable)
|
|
@@ -584,7 +583,10 @@ interface Product {
|
|
|
584
583
|
name: string;
|
|
585
584
|
brandId: string;
|
|
586
585
|
brandName: string;
|
|
587
|
-
|
|
586
|
+
technologyId: string;
|
|
587
|
+
technologyName: string;
|
|
588
|
+
categoryId: string;
|
|
589
|
+
subcategoryId: string;
|
|
588
590
|
createdAt: Date;
|
|
589
591
|
updatedAt: Date;
|
|
590
592
|
isActive: boolean;
|
|
@@ -595,86 +597,12 @@ interface Product {
|
|
|
595
597
|
composition?: string;
|
|
596
598
|
indications?: string[];
|
|
597
599
|
contraindications?: ContraindicationDynamic[];
|
|
598
|
-
/** Present only in subcollections - synced from technology metadata */
|
|
599
|
-
technologyId?: string;
|
|
600
|
-
/** Present only in subcollections - synced from technology name */
|
|
601
|
-
technologyName?: string;
|
|
602
|
-
/** Present only in subcollections - synced from technology categoryId */
|
|
603
|
-
categoryId?: string;
|
|
604
|
-
/** Present only in subcollections - synced from technology subcategoryId */
|
|
605
|
-
subcategoryId?: string;
|
|
606
600
|
}
|
|
607
601
|
/**
|
|
608
602
|
* Interface for the ProductService class
|
|
609
|
-
*
|
|
610
|
-
* NOTE: This interface maintains backward compatibility while adding new top-level collection methods.
|
|
611
|
-
* Old methods using technologyId are kept for existing code, new methods work with top-level collection.
|
|
612
603
|
*/
|
|
613
604
|
interface IProductService {
|
|
614
605
|
/**
|
|
615
|
-
* Creates a new product in the top-level collection
|
|
616
|
-
* @param brandId - ID of the brand that manufactures this product
|
|
617
|
-
* @param product - Product data
|
|
618
|
-
* @param technologyIds - Optional array of technology IDs to assign this product to
|
|
619
|
-
*/
|
|
620
|
-
createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
621
|
-
/**
|
|
622
|
-
* Gets all products from the top-level collection
|
|
623
|
-
* @param options - Query options
|
|
624
|
-
*/
|
|
625
|
-
getAllTopLevel(options: {
|
|
626
|
-
rowsPerPage: number;
|
|
627
|
-
lastVisible?: any;
|
|
628
|
-
brandId?: string;
|
|
629
|
-
}): Promise<{
|
|
630
|
-
products: Product[];
|
|
631
|
-
lastVisible: any;
|
|
632
|
-
}>;
|
|
633
|
-
/**
|
|
634
|
-
* Gets a product by ID from the top-level collection
|
|
635
|
-
* @param productId - ID of the product
|
|
636
|
-
*/
|
|
637
|
-
getByIdTopLevel(productId: string): Promise<Product | null>;
|
|
638
|
-
/**
|
|
639
|
-
* Updates a product in the top-level collection
|
|
640
|
-
* @param productId - ID of the product to update
|
|
641
|
-
* @param product - Updated product data
|
|
642
|
-
*/
|
|
643
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
|
|
644
|
-
/**
|
|
645
|
-
* Deletes a product from the top-level collection (soft delete)
|
|
646
|
-
* @param productId - ID of the product to delete
|
|
647
|
-
*/
|
|
648
|
-
deleteTopLevel(productId: string): Promise<void>;
|
|
649
|
-
/**
|
|
650
|
-
* Assigns a product to a technology
|
|
651
|
-
* @param productId - ID of the product
|
|
652
|
-
* @param technologyId - ID of the technology
|
|
653
|
-
*/
|
|
654
|
-
assignToTechnology(productId: string, technologyId: string): Promise<void>;
|
|
655
|
-
/**
|
|
656
|
-
* Unassigns a product from a technology
|
|
657
|
-
* @param productId - ID of the product
|
|
658
|
-
* @param technologyId - ID of the technology
|
|
659
|
-
*/
|
|
660
|
-
unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
|
|
661
|
-
/**
|
|
662
|
-
* Gets products assigned to a specific technology
|
|
663
|
-
* @param technologyId - ID of the technology
|
|
664
|
-
*/
|
|
665
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
666
|
-
/**
|
|
667
|
-
* Gets products NOT assigned to a specific technology
|
|
668
|
-
* @param technologyId - ID of the technology
|
|
669
|
-
*/
|
|
670
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
671
|
-
/**
|
|
672
|
-
* Gets all products for a brand
|
|
673
|
-
* @param brandId - ID of the brand
|
|
674
|
-
*/
|
|
675
|
-
getByBrand(brandId: string): Promise<Product[]>;
|
|
676
|
-
/**
|
|
677
|
-
* @deprecated Use createTopLevel instead
|
|
678
606
|
* Creates a new product
|
|
679
607
|
* @param technologyId - ID of the technology this product is used with
|
|
680
608
|
* @param brandId - ID of the brand that manufactures this product
|
|
@@ -682,7 +610,6 @@ interface IProductService {
|
|
|
682
610
|
*/
|
|
683
611
|
create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
|
|
684
612
|
/**
|
|
685
|
-
* @deprecated Use getAllTopLevel instead
|
|
686
613
|
* Gets a paginated list of all products, with optional filters.
|
|
687
614
|
*/
|
|
688
615
|
getAll(options: {
|
|
@@ -696,7 +623,6 @@ interface IProductService {
|
|
|
696
623
|
lastVisible: any;
|
|
697
624
|
}>;
|
|
698
625
|
/**
|
|
699
|
-
* @deprecated Use alternative counting methods
|
|
700
626
|
* Gets the total count of active products, with optional filters.
|
|
701
627
|
*/
|
|
702
628
|
getProductsCount(options: {
|
|
@@ -705,7 +631,6 @@ interface IProductService {
|
|
|
705
631
|
technologyId?: string;
|
|
706
632
|
}): Promise<number>;
|
|
707
633
|
/**
|
|
708
|
-
* @deprecated Use alternative counting methods
|
|
709
634
|
* Gets counts of active products grouped by category, subcategory, and technology.
|
|
710
635
|
*/
|
|
711
636
|
getProductCounts(): Promise<{
|
|
@@ -714,19 +639,16 @@ interface IProductService {
|
|
|
714
639
|
byTechnology: Record<string, number>;
|
|
715
640
|
}>;
|
|
716
641
|
/**
|
|
717
|
-
* @deprecated Use getAssignedProducts instead
|
|
718
642
|
* Gets all products for a specific technology (non-paginated, for filters/dropdowns)
|
|
719
643
|
* @param technologyId - ID of the technology
|
|
720
644
|
*/
|
|
721
645
|
getAllByTechnology(technologyId: string): Promise<Product[]>;
|
|
722
646
|
/**
|
|
723
|
-
* @deprecated Use getByBrand instead
|
|
724
647
|
* Gets all products for a brand
|
|
725
648
|
* @param brandId - ID of the brand
|
|
726
649
|
*/
|
|
727
650
|
getAllByBrand(brandId: string): Promise<Product[]>;
|
|
728
651
|
/**
|
|
729
|
-
* @deprecated Use updateTopLevel instead
|
|
730
652
|
* Updates a product
|
|
731
653
|
* @param technologyId - ID of the technology
|
|
732
654
|
* @param productId - ID of the product to update
|
|
@@ -734,14 +656,12 @@ interface IProductService {
|
|
|
734
656
|
*/
|
|
735
657
|
update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
|
|
736
658
|
/**
|
|
737
|
-
* @deprecated Use deleteTopLevel instead
|
|
738
659
|
* Deletes a product (soft delete)
|
|
739
660
|
* @param technologyId - ID of the technology
|
|
740
661
|
* @param productId - ID of the product to delete
|
|
741
662
|
*/
|
|
742
663
|
delete(technologyId: string, productId: string): Promise<void>;
|
|
743
664
|
/**
|
|
744
|
-
* @deprecated Use getByIdTopLevel instead
|
|
745
665
|
* Gets a product by ID
|
|
746
666
|
* @param technologyId - ID of the technology
|
|
747
667
|
* @param productId - ID of the product
|
|
@@ -1560,12 +1480,7 @@ declare class FilledDocumentService extends BaseService {
|
|
|
1560
1480
|
|
|
1561
1481
|
declare class ProductService extends BaseService implements IProductService {
|
|
1562
1482
|
/**
|
|
1563
|
-
* Gets reference to
|
|
1564
|
-
* @returns Firestore collection reference
|
|
1565
|
-
*/
|
|
1566
|
-
private getTopLevelProductsRef;
|
|
1567
|
-
/**
|
|
1568
|
-
* Gets reference to products collection under a technology (backward compatibility)
|
|
1483
|
+
* Gets reference to products collection under a technology
|
|
1569
1484
|
* @param technologyId - ID of the technology
|
|
1570
1485
|
* @returns Firestore collection reference
|
|
1571
1486
|
*/
|
|
@@ -1598,7 +1513,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1598
1513
|
}): Promise<number>;
|
|
1599
1514
|
/**
|
|
1600
1515
|
* Gets counts of active products grouped by category, subcategory, and technology.
|
|
1601
|
-
*
|
|
1516
|
+
* This uses a single collectionGroup query for efficiency.
|
|
1602
1517
|
*/
|
|
1603
1518
|
getProductCounts(): Promise<{
|
|
1604
1519
|
byCategory: Record<string, number>;
|
|
@@ -1625,53 +1540,6 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1625
1540
|
* Gets a product by ID
|
|
1626
1541
|
*/
|
|
1627
1542
|
getById(technologyId: string, productId: string): Promise<Product | null>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Creates a new product in the top-level collection
|
|
1630
|
-
*/
|
|
1631
|
-
createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
1632
|
-
/**
|
|
1633
|
-
* Gets all products from the top-level collection
|
|
1634
|
-
*/
|
|
1635
|
-
getAllTopLevel(options: {
|
|
1636
|
-
rowsPerPage: number;
|
|
1637
|
-
lastVisible?: any;
|
|
1638
|
-
brandId?: string;
|
|
1639
|
-
}): Promise<{
|
|
1640
|
-
products: Product[];
|
|
1641
|
-
lastVisible: any;
|
|
1642
|
-
}>;
|
|
1643
|
-
/**
|
|
1644
|
-
* Gets a product by ID from the top-level collection
|
|
1645
|
-
*/
|
|
1646
|
-
getByIdTopLevel(productId: string): Promise<Product | null>;
|
|
1647
|
-
/**
|
|
1648
|
-
* Updates a product in the top-level collection
|
|
1649
|
-
*/
|
|
1650
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Deletes a product from the top-level collection (soft delete)
|
|
1653
|
-
*/
|
|
1654
|
-
deleteTopLevel(productId: string): Promise<void>;
|
|
1655
|
-
/**
|
|
1656
|
-
* Assigns a product to a technology
|
|
1657
|
-
*/
|
|
1658
|
-
assignToTechnology(productId: string, technologyId: string): Promise<void>;
|
|
1659
|
-
/**
|
|
1660
|
-
* Unassigns a product from a technology
|
|
1661
|
-
*/
|
|
1662
|
-
unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
|
|
1663
|
-
/**
|
|
1664
|
-
* Gets products assigned to a specific technology
|
|
1665
|
-
*/
|
|
1666
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
1667
|
-
/**
|
|
1668
|
-
* Gets products NOT assigned to a specific technology
|
|
1669
|
-
*/
|
|
1670
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
1671
|
-
/**
|
|
1672
|
-
* Gets all products for a brand (from top-level collection)
|
|
1673
|
-
*/
|
|
1674
|
-
getByBrand(brandId: string): Promise<Product[]>;
|
|
1675
1543
|
}
|
|
1676
1544
|
|
|
1677
1545
|
/**
|
|
@@ -2105,10 +1973,10 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2105
1973
|
description: string;
|
|
2106
1974
|
family: ProcedureFamily;
|
|
2107
1975
|
isActive: boolean;
|
|
2108
|
-
technicalDetails?: string | undefined;
|
|
2109
|
-
contraindications: ContraindicationDynamic[];
|
|
2110
1976
|
categoryId: string;
|
|
2111
1977
|
subcategoryId: string;
|
|
1978
|
+
technicalDetails?: string | undefined;
|
|
1979
|
+
contraindications: ContraindicationDynamic[];
|
|
2112
1980
|
requirements: {
|
|
2113
1981
|
pre: Requirement[];
|
|
2114
1982
|
post: Requirement[];
|
|
@@ -2377,38 +2245,6 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2377
2245
|
* Gets all active technologies for filter dropdowns.
|
|
2378
2246
|
*/
|
|
2379
2247
|
getAllForFilter(): Promise<Technology[]>;
|
|
2380
|
-
/**
|
|
2381
|
-
* Assigns multiple products to a technology
|
|
2382
|
-
* Updates each product's assignedTechnologyIds array
|
|
2383
|
-
*/
|
|
2384
|
-
assignProducts(technologyId: string, productIds: string[]): Promise<void>;
|
|
2385
|
-
/**
|
|
2386
|
-
* Unassigns multiple products from a technology
|
|
2387
|
-
* Updates each product's assignedTechnologyIds array
|
|
2388
|
-
*/
|
|
2389
|
-
unassignProducts(technologyId: string, productIds: string[]): Promise<void>;
|
|
2390
|
-
/**
|
|
2391
|
-
* Gets products assigned to a specific technology
|
|
2392
|
-
* Reads from top-level collection for immediate consistency (Cloud Functions may lag)
|
|
2393
|
-
*/
|
|
2394
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
2395
|
-
/**
|
|
2396
|
-
* Gets products NOT assigned to a specific technology
|
|
2397
|
-
*/
|
|
2398
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
2399
|
-
/**
|
|
2400
|
-
* Gets product assignment statistics for a technology
|
|
2401
|
-
*/
|
|
2402
|
-
getProductStats(technologyId: string): Promise<{
|
|
2403
|
-
totalAssigned: number;
|
|
2404
|
-
byBrand: Record<string, number>;
|
|
2405
|
-
}>;
|
|
2406
|
-
/**
|
|
2407
|
-
* Updates products in technology subcollection when technology metadata changes
|
|
2408
|
-
* @param technologyId - ID of the technology
|
|
2409
|
-
* @param updates - Fields to update (categoryId, subcategoryId, technologyName)
|
|
2410
|
-
*/
|
|
2411
|
-
private updateProductsInSubcollection;
|
|
2412
2248
|
}
|
|
2413
2249
|
|
|
2414
2250
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -565,10 +565,9 @@ interface FilledDocumentFileValue {
|
|
|
565
565
|
*
|
|
566
566
|
* @property id - Unique identifier of the product
|
|
567
567
|
* @property name - Name of the product
|
|
568
|
-
* @property brandId - ID of the brand that manufactures this product
|
|
569
|
-
* @property brandName - Name of the brand (denormalized for display)
|
|
570
|
-
* @property assignedTechnologyIds - Array of technology IDs this product is assigned to
|
|
571
568
|
* @property description - Detailed description of the product and its purpose
|
|
569
|
+
* @property brandId - ID of the brand that manufactures this product
|
|
570
|
+
* @property technologyId - ID of the technology this product is used with
|
|
572
571
|
* @property technicalDetails - Technical details and specifications
|
|
573
572
|
* @property warnings - List of warnings related to product use
|
|
574
573
|
* @property dosage - Dosage information (if applicable)
|
|
@@ -584,7 +583,10 @@ interface Product {
|
|
|
584
583
|
name: string;
|
|
585
584
|
brandId: string;
|
|
586
585
|
brandName: string;
|
|
587
|
-
|
|
586
|
+
technologyId: string;
|
|
587
|
+
technologyName: string;
|
|
588
|
+
categoryId: string;
|
|
589
|
+
subcategoryId: string;
|
|
588
590
|
createdAt: Date;
|
|
589
591
|
updatedAt: Date;
|
|
590
592
|
isActive: boolean;
|
|
@@ -595,86 +597,12 @@ interface Product {
|
|
|
595
597
|
composition?: string;
|
|
596
598
|
indications?: string[];
|
|
597
599
|
contraindications?: ContraindicationDynamic[];
|
|
598
|
-
/** Present only in subcollections - synced from technology metadata */
|
|
599
|
-
technologyId?: string;
|
|
600
|
-
/** Present only in subcollections - synced from technology name */
|
|
601
|
-
technologyName?: string;
|
|
602
|
-
/** Present only in subcollections - synced from technology categoryId */
|
|
603
|
-
categoryId?: string;
|
|
604
|
-
/** Present only in subcollections - synced from technology subcategoryId */
|
|
605
|
-
subcategoryId?: string;
|
|
606
600
|
}
|
|
607
601
|
/**
|
|
608
602
|
* Interface for the ProductService class
|
|
609
|
-
*
|
|
610
|
-
* NOTE: This interface maintains backward compatibility while adding new top-level collection methods.
|
|
611
|
-
* Old methods using technologyId are kept for existing code, new methods work with top-level collection.
|
|
612
603
|
*/
|
|
613
604
|
interface IProductService {
|
|
614
605
|
/**
|
|
615
|
-
* Creates a new product in the top-level collection
|
|
616
|
-
* @param brandId - ID of the brand that manufactures this product
|
|
617
|
-
* @param product - Product data
|
|
618
|
-
* @param technologyIds - Optional array of technology IDs to assign this product to
|
|
619
|
-
*/
|
|
620
|
-
createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
621
|
-
/**
|
|
622
|
-
* Gets all products from the top-level collection
|
|
623
|
-
* @param options - Query options
|
|
624
|
-
*/
|
|
625
|
-
getAllTopLevel(options: {
|
|
626
|
-
rowsPerPage: number;
|
|
627
|
-
lastVisible?: any;
|
|
628
|
-
brandId?: string;
|
|
629
|
-
}): Promise<{
|
|
630
|
-
products: Product[];
|
|
631
|
-
lastVisible: any;
|
|
632
|
-
}>;
|
|
633
|
-
/**
|
|
634
|
-
* Gets a product by ID from the top-level collection
|
|
635
|
-
* @param productId - ID of the product
|
|
636
|
-
*/
|
|
637
|
-
getByIdTopLevel(productId: string): Promise<Product | null>;
|
|
638
|
-
/**
|
|
639
|
-
* Updates a product in the top-level collection
|
|
640
|
-
* @param productId - ID of the product to update
|
|
641
|
-
* @param product - Updated product data
|
|
642
|
-
*/
|
|
643
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
|
|
644
|
-
/**
|
|
645
|
-
* Deletes a product from the top-level collection (soft delete)
|
|
646
|
-
* @param productId - ID of the product to delete
|
|
647
|
-
*/
|
|
648
|
-
deleteTopLevel(productId: string): Promise<void>;
|
|
649
|
-
/**
|
|
650
|
-
* Assigns a product to a technology
|
|
651
|
-
* @param productId - ID of the product
|
|
652
|
-
* @param technologyId - ID of the technology
|
|
653
|
-
*/
|
|
654
|
-
assignToTechnology(productId: string, technologyId: string): Promise<void>;
|
|
655
|
-
/**
|
|
656
|
-
* Unassigns a product from a technology
|
|
657
|
-
* @param productId - ID of the product
|
|
658
|
-
* @param technologyId - ID of the technology
|
|
659
|
-
*/
|
|
660
|
-
unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
|
|
661
|
-
/**
|
|
662
|
-
* Gets products assigned to a specific technology
|
|
663
|
-
* @param technologyId - ID of the technology
|
|
664
|
-
*/
|
|
665
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
666
|
-
/**
|
|
667
|
-
* Gets products NOT assigned to a specific technology
|
|
668
|
-
* @param technologyId - ID of the technology
|
|
669
|
-
*/
|
|
670
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
671
|
-
/**
|
|
672
|
-
* Gets all products for a brand
|
|
673
|
-
* @param brandId - ID of the brand
|
|
674
|
-
*/
|
|
675
|
-
getByBrand(brandId: string): Promise<Product[]>;
|
|
676
|
-
/**
|
|
677
|
-
* @deprecated Use createTopLevel instead
|
|
678
606
|
* Creates a new product
|
|
679
607
|
* @param technologyId - ID of the technology this product is used with
|
|
680
608
|
* @param brandId - ID of the brand that manufactures this product
|
|
@@ -682,7 +610,6 @@ interface IProductService {
|
|
|
682
610
|
*/
|
|
683
611
|
create(technologyId: string, brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'technologyId'>): Promise<Product>;
|
|
684
612
|
/**
|
|
685
|
-
* @deprecated Use getAllTopLevel instead
|
|
686
613
|
* Gets a paginated list of all products, with optional filters.
|
|
687
614
|
*/
|
|
688
615
|
getAll(options: {
|
|
@@ -696,7 +623,6 @@ interface IProductService {
|
|
|
696
623
|
lastVisible: any;
|
|
697
624
|
}>;
|
|
698
625
|
/**
|
|
699
|
-
* @deprecated Use alternative counting methods
|
|
700
626
|
* Gets the total count of active products, with optional filters.
|
|
701
627
|
*/
|
|
702
628
|
getProductsCount(options: {
|
|
@@ -705,7 +631,6 @@ interface IProductService {
|
|
|
705
631
|
technologyId?: string;
|
|
706
632
|
}): Promise<number>;
|
|
707
633
|
/**
|
|
708
|
-
* @deprecated Use alternative counting methods
|
|
709
634
|
* Gets counts of active products grouped by category, subcategory, and technology.
|
|
710
635
|
*/
|
|
711
636
|
getProductCounts(): Promise<{
|
|
@@ -714,19 +639,16 @@ interface IProductService {
|
|
|
714
639
|
byTechnology: Record<string, number>;
|
|
715
640
|
}>;
|
|
716
641
|
/**
|
|
717
|
-
* @deprecated Use getAssignedProducts instead
|
|
718
642
|
* Gets all products for a specific technology (non-paginated, for filters/dropdowns)
|
|
719
643
|
* @param technologyId - ID of the technology
|
|
720
644
|
*/
|
|
721
645
|
getAllByTechnology(technologyId: string): Promise<Product[]>;
|
|
722
646
|
/**
|
|
723
|
-
* @deprecated Use getByBrand instead
|
|
724
647
|
* Gets all products for a brand
|
|
725
648
|
* @param brandId - ID of the brand
|
|
726
649
|
*/
|
|
727
650
|
getAllByBrand(brandId: string): Promise<Product[]>;
|
|
728
651
|
/**
|
|
729
|
-
* @deprecated Use updateTopLevel instead
|
|
730
652
|
* Updates a product
|
|
731
653
|
* @param technologyId - ID of the technology
|
|
732
654
|
* @param productId - ID of the product to update
|
|
@@ -734,14 +656,12 @@ interface IProductService {
|
|
|
734
656
|
*/
|
|
735
657
|
update(technologyId: string, productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId' | 'technologyId'>>): Promise<Product | null>;
|
|
736
658
|
/**
|
|
737
|
-
* @deprecated Use deleteTopLevel instead
|
|
738
659
|
* Deletes a product (soft delete)
|
|
739
660
|
* @param technologyId - ID of the technology
|
|
740
661
|
* @param productId - ID of the product to delete
|
|
741
662
|
*/
|
|
742
663
|
delete(technologyId: string, productId: string): Promise<void>;
|
|
743
664
|
/**
|
|
744
|
-
* @deprecated Use getByIdTopLevel instead
|
|
745
665
|
* Gets a product by ID
|
|
746
666
|
* @param technologyId - ID of the technology
|
|
747
667
|
* @param productId - ID of the product
|
|
@@ -1560,12 +1480,7 @@ declare class FilledDocumentService extends BaseService {
|
|
|
1560
1480
|
|
|
1561
1481
|
declare class ProductService extends BaseService implements IProductService {
|
|
1562
1482
|
/**
|
|
1563
|
-
* Gets reference to
|
|
1564
|
-
* @returns Firestore collection reference
|
|
1565
|
-
*/
|
|
1566
|
-
private getTopLevelProductsRef;
|
|
1567
|
-
/**
|
|
1568
|
-
* Gets reference to products collection under a technology (backward compatibility)
|
|
1483
|
+
* Gets reference to products collection under a technology
|
|
1569
1484
|
* @param technologyId - ID of the technology
|
|
1570
1485
|
* @returns Firestore collection reference
|
|
1571
1486
|
*/
|
|
@@ -1598,7 +1513,7 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1598
1513
|
}): Promise<number>;
|
|
1599
1514
|
/**
|
|
1600
1515
|
* Gets counts of active products grouped by category, subcategory, and technology.
|
|
1601
|
-
*
|
|
1516
|
+
* This uses a single collectionGroup query for efficiency.
|
|
1602
1517
|
*/
|
|
1603
1518
|
getProductCounts(): Promise<{
|
|
1604
1519
|
byCategory: Record<string, number>;
|
|
@@ -1625,53 +1540,6 @@ declare class ProductService extends BaseService implements IProductService {
|
|
|
1625
1540
|
* Gets a product by ID
|
|
1626
1541
|
*/
|
|
1627
1542
|
getById(technologyId: string, productId: string): Promise<Product | null>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Creates a new product in the top-level collection
|
|
1630
|
-
*/
|
|
1631
|
-
createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
|
|
1632
|
-
/**
|
|
1633
|
-
* Gets all products from the top-level collection
|
|
1634
|
-
*/
|
|
1635
|
-
getAllTopLevel(options: {
|
|
1636
|
-
rowsPerPage: number;
|
|
1637
|
-
lastVisible?: any;
|
|
1638
|
-
brandId?: string;
|
|
1639
|
-
}): Promise<{
|
|
1640
|
-
products: Product[];
|
|
1641
|
-
lastVisible: any;
|
|
1642
|
-
}>;
|
|
1643
|
-
/**
|
|
1644
|
-
* Gets a product by ID from the top-level collection
|
|
1645
|
-
*/
|
|
1646
|
-
getByIdTopLevel(productId: string): Promise<Product | null>;
|
|
1647
|
-
/**
|
|
1648
|
-
* Updates a product in the top-level collection
|
|
1649
|
-
*/
|
|
1650
|
-
updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Deletes a product from the top-level collection (soft delete)
|
|
1653
|
-
*/
|
|
1654
|
-
deleteTopLevel(productId: string): Promise<void>;
|
|
1655
|
-
/**
|
|
1656
|
-
* Assigns a product to a technology
|
|
1657
|
-
*/
|
|
1658
|
-
assignToTechnology(productId: string, technologyId: string): Promise<void>;
|
|
1659
|
-
/**
|
|
1660
|
-
* Unassigns a product from a technology
|
|
1661
|
-
*/
|
|
1662
|
-
unassignFromTechnology(productId: string, technologyId: string): Promise<void>;
|
|
1663
|
-
/**
|
|
1664
|
-
* Gets products assigned to a specific technology
|
|
1665
|
-
*/
|
|
1666
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
1667
|
-
/**
|
|
1668
|
-
* Gets products NOT assigned to a specific technology
|
|
1669
|
-
*/
|
|
1670
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
1671
|
-
/**
|
|
1672
|
-
* Gets all products for a brand (from top-level collection)
|
|
1673
|
-
*/
|
|
1674
|
-
getByBrand(brandId: string): Promise<Product[]>;
|
|
1675
1543
|
}
|
|
1676
1544
|
|
|
1677
1545
|
/**
|
|
@@ -2105,10 +1973,10 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2105
1973
|
description: string;
|
|
2106
1974
|
family: ProcedureFamily;
|
|
2107
1975
|
isActive: boolean;
|
|
2108
|
-
technicalDetails?: string | undefined;
|
|
2109
|
-
contraindications: ContraindicationDynamic[];
|
|
2110
1976
|
categoryId: string;
|
|
2111
1977
|
subcategoryId: string;
|
|
1978
|
+
technicalDetails?: string | undefined;
|
|
1979
|
+
contraindications: ContraindicationDynamic[];
|
|
2112
1980
|
requirements: {
|
|
2113
1981
|
pre: Requirement[];
|
|
2114
1982
|
post: Requirement[];
|
|
@@ -2377,38 +2245,6 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
|
|
|
2377
2245
|
* Gets all active technologies for filter dropdowns.
|
|
2378
2246
|
*/
|
|
2379
2247
|
getAllForFilter(): Promise<Technology[]>;
|
|
2380
|
-
/**
|
|
2381
|
-
* Assigns multiple products to a technology
|
|
2382
|
-
* Updates each product's assignedTechnologyIds array
|
|
2383
|
-
*/
|
|
2384
|
-
assignProducts(technologyId: string, productIds: string[]): Promise<void>;
|
|
2385
|
-
/**
|
|
2386
|
-
* Unassigns multiple products from a technology
|
|
2387
|
-
* Updates each product's assignedTechnologyIds array
|
|
2388
|
-
*/
|
|
2389
|
-
unassignProducts(technologyId: string, productIds: string[]): Promise<void>;
|
|
2390
|
-
/**
|
|
2391
|
-
* Gets products assigned to a specific technology
|
|
2392
|
-
* Reads from top-level collection for immediate consistency (Cloud Functions may lag)
|
|
2393
|
-
*/
|
|
2394
|
-
getAssignedProducts(technologyId: string): Promise<Product[]>;
|
|
2395
|
-
/**
|
|
2396
|
-
* Gets products NOT assigned to a specific technology
|
|
2397
|
-
*/
|
|
2398
|
-
getUnassignedProducts(technologyId: string): Promise<Product[]>;
|
|
2399
|
-
/**
|
|
2400
|
-
* Gets product assignment statistics for a technology
|
|
2401
|
-
*/
|
|
2402
|
-
getProductStats(technologyId: string): Promise<{
|
|
2403
|
-
totalAssigned: number;
|
|
2404
|
-
byBrand: Record<string, number>;
|
|
2405
|
-
}>;
|
|
2406
|
-
/**
|
|
2407
|
-
* Updates products in technology subcollection when technology metadata changes
|
|
2408
|
-
* @param technologyId - ID of the technology
|
|
2409
|
-
* @param updates - Fields to update (categoryId, subcategoryId, technologyName)
|
|
2410
|
-
*/
|
|
2411
|
-
private updateProductsInSubcollection;
|
|
2412
2248
|
}
|
|
2413
2249
|
|
|
2414
2250
|
/**
|