add slim and full location list endpoint, geometry optional

This commit is contained in:
Laura Klünder 2023-11-23 18:10:31 +01:00
parent 8b47a89865
commit 87e5e56ea1
6 changed files with 148 additions and 31 deletions

View file

@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, ClassVar, Optional
from ninja import Schema
from pydantic import Field as APIField
@ -127,20 +127,26 @@ class SpecificLocationSchema(LocationSchema):
class WithPolygonGeometrySchema(Schema):
geometry: PolygonSchema = APIField(
geometry: Optional[PolygonSchema] = APIField(
None,
title="geometry",
description="can be null if not available or excluded from endpoint",
)
class WithLineStringGeometrySchema(Schema):
geometry: LineStringSchema = APIField(
geometry: Optional[LineStringSchema] = APIField(
None,
title="geometry",
description="can be null if not available or excluded from endpoint",
)
class WithPointGeometrySchema(Schema):
geometry: PointSchema = APIField(
geometry: Optional[PointSchema] = APIField(
None,
title="geometry",
description="can be null if not available or excluded from endpoint",
)
@ -177,3 +183,4 @@ class SimpleGeometryLocationsSchema(Schema):
description="IDs of all locations that belong to this grouo",
example=(1, 2, 3),
)