UPDATE
This commit is contained in:
@@ -4,12 +4,27 @@ No database connection. All responses use static mock data from mock_data.py.
|
||||
"""
|
||||
|
||||
from rest_framework import status
|
||||
from rest_framework import serializers
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
||||
|
||||
from config.swagger import code_response
|
||||
from .mock_data import ALL_CARDS, CONFIG
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
get=extend_schema(
|
||||
tags=["Farm Dashboard"],
|
||||
responses={200: code_response("FarmDashboardConfigGetResponse", data=serializers.JSONField())},
|
||||
),
|
||||
patch=extend_schema(
|
||||
tags=["Farm Dashboard"],
|
||||
request=OpenApiTypes.OBJECT,
|
||||
responses={200: code_response("FarmDashboardConfigPatchResponse", data=serializers.JSONField())},
|
||||
),
|
||||
)
|
||||
class FarmDashboardConfigView(APIView):
|
||||
"""
|
||||
Farm dashboard config endpoints: GET and PATCH.
|
||||
@@ -27,6 +42,12 @@ class FarmDashboardConfigView(APIView):
|
||||
return Response({"code": 200, "msg": "OK", "data": CONFIG}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
get=extend_schema(
|
||||
tags=["Farm Dashboard"],
|
||||
responses={200: code_response("FarmDashboardCardsResponse", data=serializers.JSONField())},
|
||||
),
|
||||
)
|
||||
class FarmDashboardCardsView(APIView):
|
||||
"""
|
||||
Farm dashboard cards endpoint: GET.
|
||||
|
||||
Reference in New Issue
Block a user