Change remove_associated_artifact format: query param -> body param

This commit is contained in:
porink0424
2024-06-05 15:26:40 +09:00
parent 0de67317c1
commit e2995712bb
3 changed files with 10 additions and 8 deletions
+3 -3
View File
@@ -180,9 +180,9 @@ def create_app(
@app.delete("/api/studies/<study_id:int>")
@json_api_view
def delete_study(study_id: int) -> dict[str, Any]:
remove_associated_artifacts = (
True if request.params.get("remove_associated_artifacts") == "true" else False
)
data = request.json or {}
remove_associated_artifacts = data.get("remove_associated_artifacts", True)
if artifact_store is not None and remove_associated_artifacts:
delete_all_artifacts(artifact_store, storage, study_id)
+5 -3
View File
@@ -121,9 +121,11 @@ export class AxiosClient extends APIClient {
removeAssociatedArtifacts: boolean
): Promise<void> =>
this.axiosInstance
.delete(
`/api/studies/${studyId}?remove_associated_artifacts=${removeAssociatedArtifacts}`
)
.delete(`/api/studies/${studyId}`, {
data: {
remove_associated_artifacts: removeAssociatedArtifacts,
},
})
.then(() => {
return
})
+2 -2
View File
@@ -550,7 +550,7 @@ class APITestCase(TestCase):
app,
f"/api/studies/{study._study_id}",
"DELETE",
queries={"remove_associated_artifacts": "true"},
body=json.dumps({"remove_associated_artifacts": True}),
content_type="application/json",
)
self.assertEqual(status, 204)
@@ -586,7 +586,7 @@ class APITestCase(TestCase):
app,
f"/api/studies/{study._study_id}",
"DELETE",
queries={"remove_associated_artifacts": "false"},
body=json.dumps({"remove_associated_artifacts": False}),
content_type="application/json",
)
self.assertEqual(status, 204)