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

10 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 17:15 +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 CustomFieldSortProperty(StrEnum): 1a

10 created_at = "created_at" 1a

11 slug = "slug" 1a

12 custom_field_name = ( 1a

13 "name" # `name` is a reserved word, so we use `custom_field_name` 

14 ) 

15 type = "type" 1a

16 

17 

18ListSorting = Annotated[ 1a

19 list[Sorting[CustomFieldSortProperty]], 

20 Depends(SortingGetter(CustomFieldSortProperty, ["slug"])), 

21]