Эх сурвалжийг харах

Merge branch 'unstable' of blezz-tech/sharix-open-tickets into master

2 өөрчлөгдсөн 23 нэмэгдсэн , 3 устгасан
  1. 20 1
      api/v2/views/tickets.py
  2. 3 2
      urls.py

+ 20 - 1
api/v2/views/tickets.py

@@ -10,10 +10,29 @@ class TicketPatchAPIView(generics.UpdateAPIView):
     API для частичного обновления тикета
     """
 
+    queryset = Ticket.objects.all()
     serializer_class = TicketSerializer
     permission_classes = [
         permissions.IsAuthenticated | HasAPIKey
     ]
-    queryset = Ticket.objects.all()
 
 
+class TicketListAPIView(generics.ListAPIView):
+    """
+    API для получения списка тикетов
+    """
+
+    queryset = Ticket.objects.all()
+    serializer_class = TicketSerializer
+    permission_classes = [
+        permissions.IsAuthenticated | HasAPIKey
+    ]
+    filterset_fields = (
+        'title',
+        'ticket_list',
+        'ticket_type',
+        'status',
+        'created_by',
+        'assigned_to',
+    )
+

+ 3 - 2
urls.py

@@ -2,7 +2,7 @@ from django.urls import path, include
 
 from tickets.api import views as apiviews
 from tickets.views import *
-from tickets.api.v2.views.tickets import TicketPatchAPIView
+from tickets.api.v2.views.tickets import TicketPatchAPIView, TicketListAPIView
 
 app_name = "tickets"
 
@@ -16,7 +16,8 @@ api_v1_patterns = [
 ]
 
 api_v2_patterns = [
-    path('ticket/<int:pk>', TicketPatchAPIView.as_view())
+    path('ticket/<int:pk>', TicketPatchAPIView.as_view()),
+    path('ticket/', TicketListAPIView.as_view()),
 ]
 
 urlpatterns = [