forked from frankodoom/coronavirus-tracker-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
48 lines (35 loc) · 882 Bytes
/
models.py
File metadata and controls
48 lines (35 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
app.models.py
~~~~~~~~~~~~~
Reponse data models.
"""
from pydantic import BaseModel
from typing import Dict, List
class Latest(BaseModel):
confirmed: int
deaths: int
recovered: int
class LatestResponse(BaseModel):
latest: Latest
class Timeline(BaseModel):
latest: int
timeline: Dict[str, int] = {}
class Timelines(BaseModel):
confirmed: Timeline
deaths: Timeline
recovered: Timeline
class Location(BaseModel):
id: int
country: str
country_code: str
county: str = ''
province: str = ''
last_updated: str # TODO use datetime.datetime type.
coordinates: Dict
latest: Latest
timelines: Timelines = {}
class LocationsResponse(BaseModel):
latest: Latest
locations: List[Location] = []
class LocationResponse(BaseModel):
location: Location