refactor dashboard
This commit is contained in:
1 parent
cd2d211259
commit
5ad31709a9
5 files changed
+42
-34
No files matched your search
+10
-7
@@ -18,11 +18,14 @@ from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Regions(BaseModel):
|
||||
class RegionsItems(BaseModel):
|
||||
name: str
|
||||
id: str
|
||||
count_properties: int
|
||||
|
||||
class Regions(BaseModel):
|
||||
regions: List[RegionsItems]
|
||||
|
||||
class RegionBase(BaseModel):
|
||||
name: str
|
||||
id: str
|
||||
@@ -144,7 +147,7 @@ def regions():
|
||||
"""
|
||||
Returns a list of all available regions.
|
||||
"""
|
||||
return d.properties_per_region().pl().to_dicts()
|
||||
return {"regions" : d.properties_per_region().pl().to_dicts()}
|
||||
|
||||
@app.get("/region/{id}/base", response_model=RegionBase, tags=['region'])
|
||||
def region_base(id: int):
|
||||
@@ -217,11 +220,11 @@ def property_base_data(id: int):
|
||||
base = d.property_base_data(id).pl().to_dicts()
|
||||
return {
|
||||
"property_platform_id": base[0]['property_platform_id'],
|
||||
"first_found": base[0]['property_platform_id'],
|
||||
"last_found": base[0]['property_platform_id'],
|
||||
"latlng": base[0]['property_platform_id'],
|
||||
"region_id": base[0]['property_platform_id'],
|
||||
"region_name": base[0]['property_platform_id']}
|
||||
"first_found": str(base[0]['first_found']),
|
||||
"last_found": str(base[0]['last_found']),
|
||||
"latlng": base[0]['latlng'],
|
||||
"region_id": base[0]['region_id'],
|
||||
"region_name": base[0]['region_name']}
|
||||
|
||||
@app.get("/property/{id}/neighbours", response_model=PropertyNeighbours, tags=['property'])
|
||||
def property_neighbours(id: int):
|
||||
|
||||
Reference in new issue
Block a user