from typing import TYPE_CHECKING
from weaver.base import Constants
[docs]
class Sort(Constants):
[docs]
ID_LONG = "identifier" # long form employed by Processes in DB representation
[docs]
class SortMethods(Constants):
[docs]
PROCESS = frozenset([
Sort.ID,
Sort.ID_LONG, # will replace by short ID to conform with JSON representation
Sort.PROCESS, # since listing processes, can be an alias to ID
Sort.CREATED,
Sort.VERSION,
])
[docs]
JOB = frozenset([
Sort.CREATED,
Sort.FINISHED,
Sort.STATUS,
Sort.PROCESS,
Sort.SERVICE,
Sort.USER,
])
[docs]
QUOTE = frozenset([
Sort.ID,
Sort.PROCESS,
Sort.PRICE,
Sort.CREATED,
])
[docs]
BILL = frozenset([
Sort.ID,
Sort.QUOTE,
Sort.CREATED,
])
if TYPE_CHECKING:
from typing import Union
from typing_extensions import Literal
[docs]
AnySortType = Literal[
Sort.CREATED,
Sort.FINISHED,
Sort.STATUS,
Sort.PROCESS,
Sort.SERVICE,
Sort.USER,
Sort.QUOTE,
Sort.PRICE,
Sort.ID,
Sort.ID_LONG,
Sort.VERSION,
]
AnySortMethodsType = Union[
SortMethods.PROCESS,
SortMethods.JOB,
SortMethods.QUOTE,
SortMethods.BILL,
]