Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/patch object on save #341

Merged
merged 10 commits into from
Feb 14, 2022
Merged

Conversation

genie9
Copy link
Contributor

@genie9 genie9 commented Jan 27, 2022

Description

Move responsibility of adding an object to a folder on object creation and update from frontend to object endpoint.

###Related issues
Closes #335

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    Frontend now should add folder ID as a query parameter with object POST.

Changes Made

Folder id is now required query param with object POST.
A folder is patched after an object is created and updated.
Adds extraction of title for folder's objects display title.

Testing

  • Integration Tests

@blankdots
Copy link
Contributor

how is this different than #340 ?

@blankdots
Copy link
Contributor

Requires CSCfi/metadata-submitter-frontend#626 in front-end

Copy link
Contributor

@blankdots blankdots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we add the object in the folder when creating, should we still allow patching https://github.com/CSCfi/metadata-submitter/blob/develop/metadata_backend/api/handlers/folder.py#L38 metadataObjects and drafts when PATCH folder ?

metadata_backend/api/handlers/object.py Show resolved Hide resolved
@genie9
Copy link
Contributor Author

genie9 commented Jan 27, 2022

how is this different than #340 ?

changed the branch name because realized that we are not patching on the update. This obviously closed the PR.

@genie9
Copy link
Contributor Author

genie9 commented Jan 27, 2022

if we add the object in the folder when creating, should we still allow patching https://github.com/CSCfi/metadata-submitter/blob/develop/metadata_backend/api/handlers/folder.py#L38 metadataObjects and drafts when PATCH folder ?

If e.g. title of an object will change i think it should be updated to the folder metadataObjects and drafts also. And actualy this is not happening now.

how is this different than #340 ?

changed the branch name because realized that we are not patching on the update. This obviously closed the PR.

And actualy the old branch name was correct if we will be updating folder on object patch. :D

@genie9 genie9 marked this pull request as draft January 27, 2022 11:41
@blankdots
Copy link
Contributor

If e.g. title of an object will change i think it should be updated to the folder metadataObjects and drafts also. And actualy this is not happening now.

Good point, I think front-end does a PATCH or PUT for that I don't remember we need to check.

@genie9 genie9 force-pushed the refactor/patch-object-on-save branch from 281414d to b236fce Compare February 9, 2022 17:26
@genie9 genie9 marked this pull request as ready for review February 11, 2022 17:08
@genie9 genie9 requested a review from blankdots February 11, 2022 17:17
Copy link
Contributor

@blankdots blankdots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.
please add changes to CHANGELOG.md

Filename is needed for db entry (fileName and displayTitle)
when new object created from file and is assigned to folder.
Moving responsibility for adding newly created object to a folder from frontend to object endpoint.
Now folder id is required query parameter with POST object/.
Tests updated.
Update spelling wordlist.
@genie9 genie9 force-pushed the refactor/patch-object-on-save branch from 5558798 to 48fb095 Compare February 14, 2022 07:41
@blankdots blankdots linked an issue Feb 14, 2022 that may be closed by this pull request
1 task
@blankdots blankdots merged commit 197bd9f into develop Feb 14, 2022
@blankdots blankdots deleted the refactor/patch-object-on-save branch February 14, 2022 08:34
@genie9 genie9 restored the refactor/patch-object-on-save branch February 16, 2022 08:34
@blankdots blankdots mentioned this pull request Apr 7, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend object endpoint to handle patching
2 participants