Coverage for polar/custom_field/sorting.py: 100%
10 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
1from enum import StrEnum
2from typing import Annotated
4from fastapi import Depends
6from polar.kit.sorting import Sorting, SortingGetter
9class CustomFieldSortProperty(StrEnum):
10 created_at = "created_at"
11 slug = "slug"
12 custom_field_name = (
13 "name" # `name` is a reserved word, so we use `custom_field_name`
14 )
15 type = "type"
18ListSorting = Annotated[
19 list[Sorting[CustomFieldSortProperty]],
20 Depends(SortingGetter(CustomFieldSortProperty, ["slug"])),
21]