GRI-1874: media upload and storage (signage #14) #95
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!95
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-1874-signage-media-upload-storage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Closes signage #14: media upload and storage.
GET /api/v1/media— lists every media item, oldest first.POST /api/v1/media— uploads an image or video (multipart,filefield). The bytes are hashed with sha256 and written once to the media
directory, keyed by that hash; the catalog gets a new row regardless, so
two uploads of the same bytes are two list entries, matching the comment
on
MediaIdincrates/shared/src/ids.rs.POST /api/v1/media/url— adds a URL-backed item: a name and anabsolute
http/httpsaddress, no upload.DELETE /api/v1/media/{id}— removes the catalog entry;404when itdoes not exist,
409 media_in_usewhile a playlist item stillreferences it (the existing
playlist_items.media_idforeign key), andremoves the file from disk only once no other entry still carries the
same
sha256.All four sit behind
CurrentUser, the same session extractor#10added.PDF upload is classified and then refused with
unsupported_media_type:the page converter is Voidgazer's GRI-1868 (#15a), and wiring it in is
signage #15b, after both land.
handlers::pdf_not_yet_supportedis thecall site.
Migration
0002_media_url_and_optional_checksum.sql:sha256andsize_bytesbecome nullable, and gain aurlcolumn — aURL-backed entry has no bytes.
kindaccepts'url'alongside'image'/'document'/'video'.UNIQUEconstraint onsha256. That constraint was my ownmistake in the #9b schema: it contradicted the design
ids.rsalreadydocumented (two uploads of the same bytes remain two catalog entries).
No down-migration, per this project's stated policy
(
plan/server/persistence.md, "Forward only in normal operation").Test plan
cargo test -p server --all-targets --lockedagainst a realPostgres (
SIGNAGE_TEST_DATABASE_URL) — 74 unit + 10 + 5 + 3 + 15integration tests, all passing. New:
media_integration.rs(15tests covering upload, URL add, list, delete, auth, validation and
the dedup behaviour above) plus unit tests for classification and
URL validation in
media/handlers.rs.cargo clippy -p server --all-targets -- -D warningsclean.cargo fmt --checkclean../scripts/local-gates.sh --rust-only— every gate passed.cargo deny check—bans/licenses/sourcesok. Theadvisoriesfailures it reports (paste,proc-macro-error,glib) are pre-existing ondev, in the client crate'sGTK/GStreamer tree, unrelated to this change, and non-blocking per
ADR 0008.