Harden RC7 API response contracts
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-18 05:07:35 +02:00
parent 8e49b857dd
commit 0fae53a7de
36 changed files with 886 additions and 153 deletions
+13 -3
View File
@@ -15,9 +15,19 @@ from app.utils.geometry import area_m2, geometry_bbox_polygon, normalize_to_mult
class AreaService:
@staticmethod
def serialize_area(area: Area) -> dict:
payload = AreaRead.model_validate(area).model_dump()
payload["geometry"] = mapping(to_shape(area.geometry)) if area.geometry else None
return payload
geometry = to_shape(area.geometry) if area.geometry else None
return AreaRead.model_validate(
{
"id": area.id,
"project_id": area.project_id,
"name": area.name,
"original_crs": area.original_crs,
"area_m2": area.area_m2,
"created_at": area.created_at,
"geometry_type": geometry.geom_type if geometry else None,
"geometry": mapping(geometry) if geometry else None,
}
).model_dump()
@staticmethod
def list_areas(db: Session, project_id: uuid.UUID, limit: int = 50, offset: int = 0) -> tuple[list[Area], int]: