From c70b2757431d5a7b8a396a2187144c3d7eadc76d Mon Sep 17 00:00:00 2001 From: Samarpan Harit Date: Tue, 17 Dec 2024 23:17:06 +0530 Subject: [PATCH] Use task service in task view --- todo/views/task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/todo/views/task.py b/todo/views/task.py index b409cd8..823b488 100644 --- a/todo/views/task.py +++ b/todo/views/task.py @@ -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)