-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
92 lines (68 loc) · 1.73 KB
/
models.py
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from pydantic import BaseModel, Field
from typing import NamedTuple, Union, Literal, List, Any
from typing_extensions import Annotated
class EditRowAttributes(BaseModel):
table: str
database: str
gid: int
values: object
LonField = Annotated[
Union[float, int],
Field(
title='Coordinate longitude',
gt=-180,
lt=180,
),
]
LatField = Annotated[
Union[float, int],
Field(
title='Coordinate latitude',
gt=-90,
lt=90,
),
]
class Coordinates(NamedTuple):
lon: LonField
lat: LatField
class Geojson(BaseModel):
type: Literal['Point','MultiPoint','LineString','MultiLineString','Polygon','MultiPolygon']
coordinates: Coordinates
class EditRowGeometry(BaseModel):
table: str
database: str
gid: int
geojson: Geojson
class AddColumn(BaseModel):
table: str
database: str
column_name: str
column_type: Literal['text','integer','bigint','double precision','booelan','time','uuid']
class DeleteColumn(BaseModel):
table: str
database: str
column_name: str
class RowColumn(BaseModel):
column_name: str
value: str
class AddRow(BaseModel):
table: str
database: str
columns: List[RowColumn]
geojson: Geojson
class DeleteRow(BaseModel):
table: str
database: str
gid: int
class Column(BaseModel):
column_name: str
column_type: Literal['text','integer','bigint','double precision','booelan','time','uuid']
class CreateTable(BaseModel):
table: str
database: str
columns: List[Column]
geometry_type: Literal['POINT','LINESTRING','POLYGON']
srid: int=4326
class DeleteTable(BaseModel):
table: str
database: str