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

✨ [#133] Implement streaming/downloading file content #135

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

sergei-maertens
Copy link
Contributor

@sergei-maertens sergei-maertens commented Nov 13, 2024

Fixes #133

Changes

  • The binary content of the uploaded document is streamed down directly from the upstream Documenten API.
  • Upstream errors are transformed into HTTP 502 errors on our end
  • Downloads are audit logged

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
src/woo_publications/api/exceptions.py 100.00% <100.00%> (ø)
src/woo_publications/logging/constants.py 100.00% <100.00%> (ø)
src/woo_publications/logging/logevent.py 97.36% <100.00%> (+0.14%) ⬆️
src/woo_publications/logging/service.py 100.00% <ø> (ø)
src/woo_publications/publications/api/viewsets.py 100.00% <100.00%> (ø)
src/woo_publications/publications/models.py 100.00% <100.00%> (ø)

@sergei-maertens sergei-maertens force-pushed the feature/133-document-download branch from d189520 to 6f4d314 Compare November 13, 2024 12:53
@sergei-maertens sergei-maertens force-pushed the feature/133-document-download branch 2 times, most recently from 4dcbfdf to 68a220e Compare November 13, 2024 13:34
@sergei-maertens sergei-maertens marked this pull request as ready for review November 13, 2024 13:35
@sergei-maertens sergei-maertens force-pushed the feature/133-document-download branch from 1972e47 to ae2b37e Compare November 13, 2024 13:37
@@ -33,6 +33,7 @@


class Publication(models.Model):
id: int # implicitly provided by django
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the type in the factory, so now pyright knows that DocumentFactory.create() returns a Document, and existing tests have assertions using Document.id which pyright didn't understand because it's Django magic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sergei-maertens sergei-maertens merged commit 8d0a380 into main Nov 14, 2024
18 checks passed
@sergei-maertens sergei-maertens deleted the feature/133-document-download branch November 14, 2024 13:31
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.

ODRC: implement document download/file serve
2 participants