Coverage for polar/product/sorting.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 16:17 +0000

1from enum import StrEnum 1a

2from typing import Annotated 1a

3 

4from fastapi import Depends 1a

5 

6from polar.kit.sorting import Sorting, SortingGetter 1a

7 

8 

9class ProductSortProperty(StrEnum): 1a

10 created_at = "created_at" 1a

11 product_name = "name" # `name` is a reserved word, so we use `product_name` 1a

12 price_amount_type = "price_amount_type" 1a

13 price_amount = "price_amount" 1a

14 

15 

16ListSorting = Annotated[ 1a

17 list[Sorting[ProductSortProperty]], 

18 Depends(SortingGetter(ProductSortProperty, ["-created_at"])), 

19]