diff --git a/backend/project/api/serializers/observations.py b/backend/project/api/serializers/observations.py index bc16b3f..639dc5f 100644 --- a/backend/project/api/serializers/observations.py +++ b/backend/project/api/serializers/observations.py @@ -101,8 +101,36 @@ class Meta(ObservationMixin.Meta): fields = ObservationMixin.Meta.fields + ("medias",) +class AreaBBoxSerializer(serializers.ModelSerializer): + north_west = serializers.ListSerializer( + source="north_west.coords", + child=serializers.FloatField(), + max_length=2, + min_length=2, + ) + south_east = serializers.ListSerializer( + source="south_east.coords", + child=serializers.FloatField(), + max_length=2, + min_length=2, + ) + + class Meta: + model = Area + fields = ("north_west", "south_east") + + class AreaSerializer(serializers.ModelSerializer): - bbox = serializers.SerializerMethodField() + bbox2 = AreaBBoxSerializer(source="*") + bbox = serializers.ListSerializer( + child=serializers.ListSerializer( + child=serializers.FloatField(), + max_length=2, + min_length=2, + ), + max_length=2, + min_length=2, + ) def get_bbox(self, obj): return [obj.north_west.coords, obj.south_east.coords] diff --git a/backend/project/settings/__init__.py b/backend/project/settings/__init__.py index 07d08d7..ca2d434 100644 --- a/backend/project/settings/__init__.py +++ b/backend/project/settings/__init__.py @@ -174,7 +174,7 @@ "rest_framework.throttling.AnonRateThrottle", "rest_framework.throttling.UserRateThrottle", ], - "DEFAULT_THROTTLE_RATES": {"anon": "100/day", "user": "1000/day"}, + # "DEFAULT_THROTTLE_RATES": {"anon": "100/day", "user": "1000/day"}, "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework.authentication.BasicAuthentication", "rest_framework_simplejwt.authentication.JWTAuthentication",