irongit

Enhanced time synchronization for drf views.

22 lines778 BPython
1from typing import Literal, TypedDict
2
3MissingAction = Literal["continue", "noupdate"]
4
5
6class TimeCheckConf(TypedDict):
7 """Dataclass for configuring TimeCheck"""
8
9 header_field: str
10 """Field in headers to use for client timestamp"""
11 body_field: str
12 """Field in request body to use for client timestamp"""
13 instance_field: str
14 """Field in model instance to use for server timestamp"""
15 noupdate_code: int
16 """Status code for when the client is newer on a GET or client is older on a POST"""
17 missing_action: MissingAction
18 """What do do when the client does not provide a timestamp"""
19 dt_fmt: str
20 """Format used to normalize datetimes."""
21 raise_exception: bool
22 """Raise an exception or just store the should update value"""