Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dataset-metadata' into dataset-m…
Browse files Browse the repository at this point in the history
…etadata
  • Loading branch information
Aydawka committed Oct 21, 2023
2 parents f62f1e0 + 03551b6 commit d070f57
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions apis/dataset_metadata/dataset_related_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def get(self, study_id: int, dataset_id: int): # pylint: disable= unused-argume
def post(self, study_id: int, dataset_id: int):
study_obj = model.Study.query.get(study_id)
if not is_granted("dataset_metadata", study_obj):
return ("Access denied, you can not"
" make any change in dataset metadata"), 403
return (
"Access denied, you can not" " make any change in dataset metadata"
), 403
data: Union[Any, dict] = request.json
data_obj = model.Dataset.query.get(dataset_id)
list_of_elements: List = []
for i in data:
if "id" in i and i["id"]:
dataset_related_item_ = (
model.DatasetRelatedItem.query.get(i["id"]))
dataset_related_item_ = model.DatasetRelatedItem.query.get(i["id"])
if not dataset_related_item_:
return f"{i['id']} Id is not found", 404
dataset_related_item_.update(i)
Expand Down Expand Up @@ -163,8 +163,7 @@ def post(self, study_id: int, dataset_id: int):
return [item.to_dict() for item in data_obj.dataset_related_item], 201


@api.route("/study/<study_id>/dataset/<dataset_id>"
"/related-item/<related_item_id>")
@api.route("/study/<study_id>/dataset/<dataset_id>" "/related-item/<related_item_id>")
class DatasetRelatedItemUpdate(Resource):
@api.doc("delete related item")
@api.response(200, "Success")
Expand Down Expand Up @@ -250,7 +249,7 @@ def delete(
study_id: int,
dataset_id: int, # pylint: disable= unused-argument
related_item_id: int, # pylint: disable= unused-argument
identifier_id: int
identifier_id: int,
):
study_obj = model.Study.query.get(study_id)
if not is_granted("dataset_metadata", study_obj):
Expand Down

0 comments on commit d070f57

Please sign in to comment.