Skip to content

Commit

Permalink
Use task service in task view
Browse files Browse the repository at this point in the history
  • Loading branch information
samarpan1738 committed Dec 22, 2024
1 parent 683b8ee commit c70b275
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion todo/views/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
from rest_framework import status
from rest_framework.request import Request
from todo.serializers.get_tasks_serializer import GetTaskQueryParamsSerializer
from todo.services.task_service import TaskService


class TaskView(APIView):
def get(self, request: Request):
query = GetTaskQueryParamsSerializer(data=request.query_params)
query.is_valid(raise_exception=True)
return Response({}, status.HTTP_200_OK)
page = query.validated_data["page"]
limit = query.validated_data["limit"]
response = TaskService.get_tasks(page, limit)
return Response(response.model_dump(mode="json", exclude_none=True), status.HTTP_200_OK)

0 comments on commit c70b275

Please sign in to comment.