Skip to content

Commit

Permalink
new task polling view (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo authored Nov 30, 2023
1 parent 21231e8 commit 0100a7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/tasks/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.urls import path

from .views import TasksView, TasksByExpenseGroupIdView
from .views import TasksView, TasksByExpenseGroupIdView, NewTaskView

urlpatterns = [
path('expense_group/<int:expense_group_id>/', TasksByExpenseGroupIdView.as_view(), name='task-by-expense-group-id'),
path('all/', TasksView.as_view(), name='all-tasks')
path('all/', TasksView.as_view(), name='all-tasks'),
path('v2/all,', NewTaskView.as_view(), name='new-all-tasks')
]
12 changes: 12 additions & 0 deletions apps/tasks/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from fyle_netsuite_api.utils import LookupFieldMixin
from rest_framework import generics

from .helpers import filter_tasks_by_params
from .models import TaskLog
from .serializers import TaskLogSerializer
from django_filters.rest_framework import DjangoFilterBackend


class TasksView(generics.ListAPIView):
Expand All @@ -25,3 +27,13 @@ class TasksByExpenseGroupIdView(generics.RetrieveAPIView):
serializer_class = TaskLogSerializer
lookup_field = 'expense_group_id'
queryset = TaskLog.objects.all()


class NewTaskView(LookupFieldMixin, generics.ListAPIView):

serializer_class = TaskLogSerializer
queryset = TaskLog.objects.all()
pagination_class = None
filter_backends = (DjangoFilterBackend,)
filterset_fields = {'task':{'in','exact'}, 'expense_group_ids':{'in', 'exact'}, 'status': {'in', 'exact'}}
ordering = ['-updated_at']

0 comments on commit 0100a7d

Please sign in to comment.