mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Updates the post view to return the async task id. Adds query parameter to the tasks endpoint to get single task status
This commit is contained in:
parent
a83058ab11
commit
50c0c65c60
@ -617,7 +617,7 @@ class PostDocumentView(GenericAPIView):
|
|||||||
|
|
||||||
task_id = str(uuid.uuid4())
|
task_id = str(uuid.uuid4())
|
||||||
|
|
||||||
consume_file.delay(
|
async_task = consume_file.delay(
|
||||||
temp_filename,
|
temp_filename,
|
||||||
override_filename=doc_name,
|
override_filename=doc_name,
|
||||||
override_title=title,
|
override_title=title,
|
||||||
@ -628,7 +628,7 @@ class PostDocumentView(GenericAPIView):
|
|||||||
override_created=created,
|
override_created=created,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response("OK")
|
return Response(async_task.id)
|
||||||
|
|
||||||
|
|
||||||
class SelectionDataView(GenericAPIView):
|
class SelectionDataView(GenericAPIView):
|
||||||
@ -886,13 +886,18 @@ class TasksViewSet(ReadOnlyModelViewSet):
|
|||||||
permission_classes = (IsAuthenticated,)
|
permission_classes = (IsAuthenticated,)
|
||||||
serializer_class = TasksViewSerializer
|
serializer_class = TasksViewSerializer
|
||||||
|
|
||||||
queryset = (
|
def get_queryset(self):
|
||||||
PaperlessTask.objects.filter(
|
queryset = (
|
||||||
acknowledged=False,
|
PaperlessTask.objects.filter(
|
||||||
|
acknowledged=False,
|
||||||
|
)
|
||||||
|
.order_by("date_created")
|
||||||
|
.reverse()
|
||||||
)
|
)
|
||||||
.order_by("date_created")
|
task_id = self.request.query_params.get("task_id")
|
||||||
.reverse()
|
if task_id is not None:
|
||||||
)
|
queryset = PaperlessTask.objects.filter(task_id=task_id)
|
||||||
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
class AcknowledgeTasksView(GenericAPIView):
|
class AcknowledgeTasksView(GenericAPIView):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user