first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from app.models.common import GeoJSON
|
||||
|
||||
|
||||
class BuildingsQueryRequest(BaseModel):
|
||||
bbox: tuple[float, float, float, float] | None = None
|
||||
path: GeoJSON | None = None
|
||||
buffer_m: float = Field(default=50, ge=0)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_query_shape(self) -> "BuildingsQueryRequest":
|
||||
if self.bbox is None and self.path is None:
|
||||
raise ValueError("Either bbox or path must be provided")
|
||||
return self
|
||||
|
||||
|
||||
class BuildingsQueryResponse(BaseModel):
|
||||
type: str = "FeatureCollection"
|
||||
features: list[GeoJSON]
|
||||
Reference in New Issue
Block a user