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

fix: align schedule create/update conflict responses with documentation

The conflict responses should be send with an HTTP 409 status code as
they’re defined in our documentation. This was not the case as the
dashboard couldn’t handle these error codes, but is now fixed in
dashboard@4a07ad9e.
parent 293c78c5
No related branches found
No related tags found
1 merge request!22refactor schedule REST API
Pipeline #1850 passed
...@@ -487,8 +487,7 @@ class APIScheduleViewSet( ...@@ -487,8 +487,7 @@ class APIScheduleViewSet(
try: try:
resolution = Schedule.resolve_conflicts(request.data, pk, show_pk) resolution = Schedule.resolve_conflicts(request.data, pk, show_pk)
except ScheduleConflictError as exc: except ScheduleConflictError as exc:
# TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it return Response(exc.conflicts, status.HTTP_409_CONFLICT)
return Response(exc.conflicts)
if all(key in resolution for key in ["create", "update", "delete"]): if all(key in resolution for key in ["create", "update", "delete"]):
# this is a dry-run # this is a dry-run
...@@ -535,8 +534,7 @@ class APIScheduleViewSet( ...@@ -535,8 +534,7 @@ class APIScheduleViewSet(
request.data, schedule.pk, schedule.show.pk request.data, schedule.pk, schedule.show.pk
) )
except ScheduleConflictError as exc: except ScheduleConflictError as exc:
# TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it return Response(exc.conflicts, status.HTTP_409_CONFLICT)
return Response(exc.conflicts)
return Response(resolution) return Response(resolution)
......
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