neicnordic / sensitive-data-archive

https://neic-sda.readthedocs.io
GNU Affero General Public License v3.0
3 stars 7 forks source link

[api] delete file #1122

Open MalinAhlberg opened 3 weeks ago

MalinAhlberg commented 3 weeks ago

Related issue(s) and PR(s)
This PR closes #1134 .

Description This PR adds the delete file functionality to the api component. Specifically, it deletes the file from the inbox and it adds a new file log event, setting the file status to disabled.

Also, it adds the fileID to the list functionality of the api, since that field is needed in order to delete a file:

curl -H "Authorization: Bearer $token" "http://localhost:8090/users/test@dummy.org/files" | jq .
[
  {
    "fileID": "d32f7117-bb85-40e2-9c52-101bf9c1ca5a",
    "inboxPath": "test_dummy.org/race_file.c4gh",
    "fileStatus": "ready",
    "createAt": "2024-11-19T10:50:07.836513Z"
  },
  {...

How to test make build-all then PR_NUMBER=$(date +%F) docker compose -f .github/integration/sda-s3-integration.yml run integration_test. List the files (eg with http://localhost:8090/users/test@dummy.org/files) and make sure files in the inbox can be deleted, and that archived files can not be deleted.

MalinAhlberg commented 2 days ago

Great comments @kostas-kou ! Fixed most of them in 92903a6, ~but left this one for others to see~ <- solved during stand-up.

MalinAhlberg commented 17 hours ago

@kostas-kou and @pahatz, thanks for your reviews! I have fixed the weird comment, rebased on main and also rebased to get rid of the fixup-commits. Only 3ac7e5e is new, the rest is the same as when you reviewed.

MalinAhlberg commented 16 hours ago

...and added 8a745c4 for the rbac