-
Notifications
You must be signed in to change notification settings - Fork 492
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
Extend Datasets API to support dataset deaccession and recovery of files and file counts of deaccessioned datasets #9937
Conversation
…averse into 9852-files-api-deaccessioned-datasets
This comment has been minimized.
This comment has been minimized.
…averse into 9852-files-api-deaccessioned-datasets
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…oadSize datasets API endpoint
…inal tab file sizes
…s for /downloadsize API endpoint
…SS/dataverse into 9958-dataset-files-size
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! passing to QA
New API option to get the download size of the dataset version files without the original tabular files size
…pi-deaccessioned-datasets
@kcondon Conflicts fixed. |
This comment has been minimized.
This comment has been minimized.
@GPortas
|
This comment has been minimized.
This comment has been minimized.
I apologize. I again forgot to update the description with the latest status of changes (like in other PR). Anyway, I had to update the documentation because the example curl calls were not correct, as you explained. I've updated both the docs and the example calls in the PR description so you can test it now. Regarding the getVersionFiles and getVersionFileCounts calls with the includeDeaccessioned option and without sending credentials (guest user), they were indeed not working correctly. The EditDataset permission check was missing for the GetSpecificPublishedDatasetVersionCommand command. I've fixed this and covered that case with integration tests. |
This comment has been minimized.
This comment has been minimized.
@GPortas Thanks, looks great! |
@GPortas Darn, just noticed merge conflicts. Can you take a look? Otherwise good to merge. Thanks! Just realized it might be due to my merging the other count pr. I also noticed a couple failing tests: |
@kcondon Thanks! I run the failing tests on my localhost and they don't fail. Can you give me more information about those failing tests? (If possible, the assertions that are failing). Maybe some trace from the Jenkins output? I currently don't have access to Jenkins and can't see it. Now working on resolving conflicts. |
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
What this PR does / why we need it:
This PR extends the following endpoints related to dataset version files:
The above endpoints now accept a new boolean optional query parameter "includeDeaccessioned", which, if enabled, causes the endpoint to consider deaccessioned versions when searching for versions to obtain files or file counts. To do this, the following existing commands were modified:
This logic is required for the SPA to display file metadata for deaccessioned dataset versions.
Additionally, a new endpoint has been developed to support version deaccessioning through API (Given a dataset and a version): "{id}/versions/{versionId}/deaccession".
The version identifiers ":latest", ":latest-published" and ":draft" have been extracted to API constants (ApiConstants.java), since these strings were hardcoded throughout the application and this way it is easier to manage them.
Finally, the DataFile API payload has been extended to add the field "friendlyType", as described in IQSS/dataverse-frontend#169 (comment)
Which issue(s) this PR closes:
Suggestions on how to test this:
Create a dataset version and publish it
Deaccession dataset version via curl:
Create a deaccession.json file, which should like this:
Export the following variables:
Then, call the deaccession endpoint:
curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/datasets/$ID/versions/$VERSIONID/deaccession" -H "Content-type:application/json" --upload-file $FILE_PATH
curl "$SERVER_URL/api/datasets/$ID/versions/$VERSIONID/files?includeDeaccessioned=true"
curl "$SERVER_URL/api/datasets/$ID/versions/$VERSIONID/files/counts?includeDeaccessioned=true"
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No
Is there a release notes update needed for this change?:
Yes