forked from ExpDev07/coronavirus-tracker-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
75 lines (53 loc) · 1.09 KB
/
models.py
File metadata and controls
75 lines (53 loc) · 1.09 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""app.models.py"""
from typing import Dict, List
from pydantic import BaseModel
class Latest(BaseModel):
"""
Latest model.
"""
confirmed: int
deaths: int
recovered: int
class LatestResponse(BaseModel):
"""
Response for latest.
"""
latest: Latest
class Timeline(BaseModel):
"""
Timeline model.
"""
latest: int
timeline: Dict[str, int] = {}
class Timelines(BaseModel):
"""
Timelines model.
"""
confirmed: Timeline
deaths: Timeline
recovered: Timeline
class Location(BaseModel):
"""
Location model.
"""
id: int
country: str
country_code: str
country_population: int = None
province: str = ""
county: str = ""
last_updated: str # TODO use datetime.datetime type.
coordinates: Dict
latest: Latest
timelines: Timelines = {}
class LocationResponse(BaseModel):
"""
Response for location.
"""
location: Location
class LocationsResponse(BaseModel):
"""
Response for locations.
"""
latest: Latest
locations: List[Location] = []