Skip to content
Snippets Groups Projects
Commit 09c8642b authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: return schedule dry-runs with a separate status code

Schedule dry-runs returned a 201 response before, because the only check
for a 201 return code was, that the payload must not contain the
"projected" keyword.

As dry-runs don’t create any data 201 is not an appropriate status code.
parent eb3f33ac
No related branches found
No related tags found
1 merge request!21Add API documentation
...@@ -372,6 +372,10 @@ class APIScheduleViewSet( ...@@ -372,6 +372,10 @@ class APIScheduleViewSet(
# Otherwise try to resolve # Otherwise try to resolve
resolution = Schedule.resolve_conflicts(request.data, pk, show_pk) resolution = Schedule.resolve_conflicts(request.data, pk, show_pk)
if all(key in resolution for key in ["create", "update", "delete"]):
# this is a dry-run
return Response(resolution, status=status.HTTP_202_ACCEPTED)
# If resolution went well # If resolution went well
if "projected" not in resolution: if "projected" not in resolution:
return Response(resolution, status=status.HTTP_201_CREATED) return Response(resolution, status=status.HTTP_201_CREATED)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment