how about some bugfixing?
This commit is contained in:
parent
3f8e42d13e
commit
62cffe9644
3 changed files with 15 additions and 15 deletions
|
@ -202,7 +202,7 @@ class SpecificLocation(Location, models.Model):
|
|||
result['label_settings'] = label_settings.serialize(detailed=False)
|
||||
if self.label_overrides:
|
||||
# todo: what if only one language is set?
|
||||
result['label_override'] = self.label_override
|
||||
result['label_override'] = str(self.label_override)
|
||||
return result
|
||||
|
||||
def get_label_settings(self):
|
||||
|
|
|
@ -166,14 +166,7 @@ class WithSpaceSchema(SerializableSchema):
|
|||
)
|
||||
|
||||
|
||||
class SimpleGeometryBoundsSchema(Schema):
|
||||
bounds: tuple[tuple[float, float], tuple[float, float]] = APIField(
|
||||
description="location bounding box from (x, y) to (x, y)",
|
||||
example=((-10, -20), (20, 30)),
|
||||
)
|
||||
|
||||
|
||||
class SimpleGeometryBoundsAndPointSchema(SimpleGeometryBoundsSchema):
|
||||
class SimpleGeometryPointSchema(Schema):
|
||||
point: tuple[
|
||||
Annotated[PositiveInt, APIField(title="level ID")],
|
||||
Annotated[float, APIField(title="x coordinate")],
|
||||
|
@ -185,6 +178,13 @@ class SimpleGeometryBoundsAndPointSchema(SimpleGeometryBoundsSchema):
|
|||
)
|
||||
|
||||
|
||||
class SimpleGeometryPointAndBoundsSchema(SimpleGeometryPointSchema):
|
||||
bounds: tuple[tuple[float, float], tuple[float, float]] = APIField(
|
||||
description="location bounding box from (x, y) to (x, y)",
|
||||
example=((-10, -20), (20, 30)),
|
||||
)
|
||||
|
||||
|
||||
class SimpleGeometryLocationsSchema(Schema):
|
||||
locations: list[PositiveInt] = APIField( # todo: this should be a set… but json serialization?
|
||||
description="IDs of all locations that belong to this grouo",
|
||||
|
|
|
@ -9,7 +9,7 @@ from c3nav.api.schema import GeometrySchema, PointSchema
|
|||
from c3nav.api.utils import NonEmptyStr
|
||||
from c3nav.mapdata.schemas.model_base import (AnyLocationID, AnyPositionID, CustomLocationID, DjangoModelSchema,
|
||||
LabelSettingsSchema, LocationSchema, PositionID, SerializableSchema,
|
||||
SimpleGeometryBoundsAndPointSchema, SimpleGeometryBoundsSchema,
|
||||
SimpleGeometryPointAndBoundsSchema, SimpleGeometryPointSchema,
|
||||
SimpleGeometryLocationsSchema, SpecificLocationSchema, TitledSchema,
|
||||
WithAccessRestrictionSchema, WithLevelSchema,
|
||||
WithLineStringGeometrySchema, WithPointGeometrySchema,
|
||||
|
@ -416,7 +416,7 @@ class FullLevelLocationSchema(LevelSchema):
|
|||
locationtype: Literal["level"]
|
||||
|
||||
|
||||
class FullSpaceLocationSchema(SimpleGeometryBoundsAndPointSchema, SpaceSchema):
|
||||
class FullSpaceLocationSchema(SimpleGeometryPointAndBoundsSchema, SpaceSchema):
|
||||
"""
|
||||
A space with some additional information for the location API.
|
||||
See Space schema for details.
|
||||
|
@ -424,7 +424,7 @@ class FullSpaceLocationSchema(SimpleGeometryBoundsAndPointSchema, SpaceSchema):
|
|||
locationtype: Literal["space"]
|
||||
|
||||
|
||||
class FullAreaLocationSchema(SimpleGeometryBoundsAndPointSchema, AreaSchema):
|
||||
class FullAreaLocationSchema(SimpleGeometryPointAndBoundsSchema, AreaSchema):
|
||||
"""
|
||||
An area with some additional information for the location API.
|
||||
See Area schema for details.
|
||||
|
@ -432,7 +432,7 @@ class FullAreaLocationSchema(SimpleGeometryBoundsAndPointSchema, AreaSchema):
|
|||
locationtype: Literal["area"]
|
||||
|
||||
|
||||
class FullPOILocationSchema(SimpleGeometryBoundsSchema, POISchema):
|
||||
class FullPOILocationSchema(SimpleGeometryPointSchema, POISchema):
|
||||
"""
|
||||
A point of interest with some additional information for the location API.
|
||||
See POI schema for details.
|
||||
|
@ -448,7 +448,7 @@ class FullLocationGroupLocationSchema(SimpleGeometryLocationsSchema, LocationGro
|
|||
locationtype: Literal["locationgroup"]
|
||||
|
||||
|
||||
class FullDynamicLocationLocationSchema(SimpleGeometryLocationsSchema, DynamicLocationSchema):
|
||||
class FullDynamicLocationLocationSchema(DynamicLocationSchema):
|
||||
"""
|
||||
A dynamic location for the location API.
|
||||
See DynamicLocation schema for details.
|
||||
|
@ -456,7 +456,7 @@ class FullDynamicLocationLocationSchema(SimpleGeometryLocationsSchema, DynamicLo
|
|||
locationtype: Literal["dynamiclocation"]
|
||||
|
||||
|
||||
class CustomLocationLocationSchema(SimpleGeometryBoundsAndPointSchema, CustomLocationSchema):
|
||||
class CustomLocationLocationSchema(SimpleGeometryPointAndBoundsSchema, CustomLocationSchema):
|
||||
"""
|
||||
A custom location for the location API.
|
||||
See CustomLocation schema for details.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue