add more mapdata endpoints, completing the mapdata API tag
This commit is contained in:
parent
846101ea37
commit
141ab7489e
3 changed files with 76 additions and 16 deletions
|
@ -10,12 +10,6 @@ from c3nav.api.schema import LineStringSchema, PointSchema, PolygonSchema
|
|||
from c3nav.api.utils import NonEmptyStr
|
||||
|
||||
|
||||
class DjangoModelSchema(Schema):
|
||||
id: PositiveInt = APIField(
|
||||
title="ID",
|
||||
)
|
||||
|
||||
|
||||
class SerializableSchema(Schema):
|
||||
@model_validator(mode="wrap") # noqa
|
||||
@classmethod
|
||||
|
@ -25,6 +19,12 @@ class SerializableSchema(Schema):
|
|||
return handler(values)
|
||||
|
||||
|
||||
class DjangoModelSchema(SerializableSchema):
|
||||
id: PositiveInt = APIField(
|
||||
title="ID",
|
||||
)
|
||||
|
||||
|
||||
class LocationSlugSchema(Schema):
|
||||
slug: NonEmptyStr = APIField(
|
||||
title="location slug",
|
||||
|
@ -36,7 +36,7 @@ class LocationSlugSchema(Schema):
|
|||
)
|
||||
|
||||
|
||||
class AccessRestrictionSchema(Schema):
|
||||
class WithAccessRestrictionSchema(Schema):
|
||||
access_restriction: Optional[PositiveInt] = APIField(
|
||||
default=None,
|
||||
title="access restriction ID",
|
||||
|
@ -58,7 +58,7 @@ class TitledSchema(Schema):
|
|||
)
|
||||
|
||||
|
||||
class LocationSchema(AccessRestrictionSchema, TitledSchema, LocationSlugSchema, SerializableSchema):
|
||||
class LocationSchema(WithAccessRestrictionSchema, TitledSchema, LocationSlugSchema):
|
||||
subtitle: NonEmptyStr = APIField(
|
||||
title="subtitle (preferred language)",
|
||||
description="an automatically generated short description for this location. "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue