feat(phase-4-05): document streaming proxy GET /api/documents/{id}/content (DOC-02)

- Add _parse_range() helper: validates Range header bounds, raises 416 on invalid
- Add stream_document_content endpoint with get_regular_user dep (admin → 403)
- Access check: owner OR Share.recipient_id; neither → 404
- Bytes fetched via get_object() only — presigned_get_url() never called
- Range requests return 206 + Content-Range header
- Add pdf_open_mode column to User ORM model (migration 0004 already applied)
- Use HTTP_416_RANGE_NOT_SATISFIABLE (non-deprecated constant)
This commit is contained in:
curo1305
2026-05-25 18:48:32 +02:00
parent 364447d0bc
commit f868a4e0c7
2 changed files with 99 additions and 1 deletions
+3
View File
@@ -61,6 +61,9 @@ class User(Base):
default_storage_backend: Mapped[str] = mapped_column(
String, nullable=False, default="minio"
)
pdf_open_mode: Mapped[str] = mapped_column(
String, nullable=False, server_default="in_app"
)
created_at: Mapped[datetime] = mapped_column(
TIMESTAMP(timezone=True), nullable=False, server_default=func.now()
)