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())
|
||||
|
||||
consume_file.delay(
|
||||
async_task = consume_file.delay(
|
||||
temp_filename,
|
||||
override_filename=doc_name,
|
||||
override_title=title,
|
||||
@ -628,7 +628,7 @@ class PostDocumentView(GenericAPIView):
|
||||
override_created=created,
|
||||
)
|
||||
|
||||
return Response("OK")
|
||||
return Response(async_task.id)
|
||||
|
||||
|
||||
class SelectionDataView(GenericAPIView):
|
||||
@ -886,6 +886,7 @@ class TasksViewSet(ReadOnlyModelViewSet):
|
||||
permission_classes = (IsAuthenticated,)
|
||||
serializer_class = TasksViewSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = (
|
||||
PaperlessTask.objects.filter(
|
||||
acknowledged=False,
|
||||
@ -893,6 +894,10 @@ class TasksViewSet(ReadOnlyModelViewSet):
|
||||
.order_by("date_created")
|
||||
.reverse()
|
||||
)
|
||||
task_id = self.request.query_params.get("task_id")
|
||||
if task_id is not None:
|
||||
queryset = PaperlessTask.objects.filter(task_id=task_id)
|
||||
return queryset
|
||||
|
||||
|
||||
class AcknowledgeTasksView(GenericAPIView):
|
||||
|
Loading…
x
Reference in New Issue
Block a user