how about some bugfixing?

This commit is contained in:
Laura Klünder 2023-11-24 16:31:39 +01:00
parent 3f8e42d13e
commit 62cffe9644
3 changed files with 15 additions and 15 deletions

View file

@ -202,7 +202,7 @@ class SpecificLocation(Location, models.Model):
result['label_settings'] = label_settings.serialize(detailed=False) result['label_settings'] = label_settings.serialize(detailed=False)
if self.label_overrides: if self.label_overrides:
# todo: what if only one language is set? # todo: what if only one language is set?
result['label_override'] = self.label_override result['label_override'] = str(self.label_override)
return result return result
def get_label_settings(self): def get_label_settings(self):

View file

@ -166,14 +166,7 @@ class WithSpaceSchema(SerializableSchema):
) )
class SimpleGeometryBoundsSchema(Schema): class SimpleGeometryPointSchema(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):
point: tuple[ point: tuple[
Annotated[PositiveInt, APIField(title="level ID")], Annotated[PositiveInt, APIField(title="level ID")],
Annotated[float, APIField(title="x coordinate")], 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): class SimpleGeometryLocationsSchema(Schema):
locations: list[PositiveInt] = APIField( # todo: this should be a set… but json serialization? locations: list[PositiveInt] = APIField( # todo: this should be a set… but json serialization?
description="IDs of all locations that belong to this grouo", description="IDs of all locations that belong to this grouo",

View file

@ -9,7 +9,7 @@ from c3nav.api.schema import GeometrySchema, PointSchema
from c3nav.api.utils import NonEmptyStr from c3nav.api.utils import NonEmptyStr
from c3nav.mapdata.schemas.model_base import (AnyLocationID, AnyPositionID, CustomLocationID, DjangoModelSchema, from c3nav.mapdata.schemas.model_base import (AnyLocationID, AnyPositionID, CustomLocationID, DjangoModelSchema,
LabelSettingsSchema, LocationSchema, PositionID, SerializableSchema, LabelSettingsSchema, LocationSchema, PositionID, SerializableSchema,
SimpleGeometryBoundsAndPointSchema, SimpleGeometryBoundsSchema, SimpleGeometryPointAndBoundsSchema, SimpleGeometryPointSchema,
SimpleGeometryLocationsSchema, SpecificLocationSchema, TitledSchema, SimpleGeometryLocationsSchema, SpecificLocationSchema, TitledSchema,
WithAccessRestrictionSchema, WithLevelSchema, WithAccessRestrictionSchema, WithLevelSchema,
WithLineStringGeometrySchema, WithPointGeometrySchema, WithLineStringGeometrySchema, WithPointGeometrySchema,
@ -416,7 +416,7 @@ class FullLevelLocationSchema(LevelSchema):
locationtype: Literal["level"] locationtype: Literal["level"]
class FullSpaceLocationSchema(SimpleGeometryBoundsAndPointSchema, SpaceSchema): class FullSpaceLocationSchema(SimpleGeometryPointAndBoundsSchema, SpaceSchema):
""" """
A space with some additional information for the location API. A space with some additional information for the location API.
See Space schema for details. See Space schema for details.
@ -424,7 +424,7 @@ class FullSpaceLocationSchema(SimpleGeometryBoundsAndPointSchema, SpaceSchema):
locationtype: Literal["space"] locationtype: Literal["space"]
class FullAreaLocationSchema(SimpleGeometryBoundsAndPointSchema, AreaSchema): class FullAreaLocationSchema(SimpleGeometryPointAndBoundsSchema, AreaSchema):
""" """
An area with some additional information for the location API. An area with some additional information for the location API.
See Area schema for details. See Area schema for details.
@ -432,7 +432,7 @@ class FullAreaLocationSchema(SimpleGeometryBoundsAndPointSchema, AreaSchema):
locationtype: Literal["area"] locationtype: Literal["area"]
class FullPOILocationSchema(SimpleGeometryBoundsSchema, POISchema): class FullPOILocationSchema(SimpleGeometryPointSchema, POISchema):
""" """
A point of interest with some additional information for the location API. A point of interest with some additional information for the location API.
See POI schema for details. See POI schema for details.
@ -448,7 +448,7 @@ class FullLocationGroupLocationSchema(SimpleGeometryLocationsSchema, LocationGro
locationtype: Literal["locationgroup"] locationtype: Literal["locationgroup"]
class FullDynamicLocationLocationSchema(SimpleGeometryLocationsSchema, DynamicLocationSchema): class FullDynamicLocationLocationSchema(DynamicLocationSchema):
""" """
A dynamic location for the location API. A dynamic location for the location API.
See DynamicLocation schema for details. See DynamicLocation schema for details.
@ -456,7 +456,7 @@ class FullDynamicLocationLocationSchema(SimpleGeometryLocationsSchema, DynamicLo
locationtype: Literal["dynamiclocation"] locationtype: Literal["dynamiclocation"]
class CustomLocationLocationSchema(SimpleGeometryBoundsAndPointSchema, CustomLocationSchema): class CustomLocationLocationSchema(SimpleGeometryPointAndBoundsSchema, CustomLocationSchema):
""" """
A custom location for the location API. A custom location for the location API.
See CustomLocation schema for details. See CustomLocation schema for details.