feat(api): artwork upload endpoint (#104) #117

Merged
timothy merged 1 commits from feat/104-artwork-upload into main 2026-07-03 23:41:49 +02:00
Owner

Endpoint

POST /api/artwork/uploads (multipart/form-data) — upload channel logo or watermark artwork.

  • file: image (png/jpeg/gif/webp), max size SystemEnvironment.MaximumUploadMb (default 10 MB, ETV_MAXIMUM_UPLOAD_MB) — mirrors the Blazor upload path.
  • target: logo (default) or watermark.
  • Stores via IImageCache.SaveArtworkToCache (SHA1 content-addressed, same dedup as Blazor).
  • Returns 201 { path, contentType } — path is directly consumable as CreateChannel.Logo (iptv/logos/{file} for logos, bare cache filename for watermarks); Location header carries the servable URL incl. required ?contentType=.
  • All failures: 422 ProblemDetails, title Validation failed (contract-test entry added). No 404 surface.

Includes handler + controller tests (310 total pass), regenerated v1.json.

Adversarial review verdict

One MAJOR (missing #nullable enable on the response DTO → spec documented nullable strings) — fixed, spec now emits plain string. Minors noted, deliberately deferred: bare 413 above Kestrel 30 MB limit (consistent app-wide), Location for logos points at the conditionally-authorized IPTV route, content-type trusted from client (parity with legacy; magic-byte sniffing = #66). Parity with the Blazor path verified: same cache, same dedup, same path conventions; API is stricter-validated than Blazor.

fixes #104

🤖 Generated with Claude Code

## Endpoint `POST /api/artwork/uploads` (multipart/form-data) — upload channel logo or watermark artwork. - `file`: image (png/jpeg/gif/webp), max size `SystemEnvironment.MaximumUploadMb` (default 10 MB, `ETV_MAXIMUM_UPLOAD_MB`) — mirrors the Blazor upload path. - `target`: `logo` (default) or `watermark`. - Stores via `IImageCache.SaveArtworkToCache` (SHA1 content-addressed, same dedup as Blazor). - Returns 201 `{ path, contentType }` — `path` is directly consumable as `CreateChannel.Logo` (`iptv/logos/{file}` for logos, bare cache filename for watermarks); Location header carries the servable URL incl. required `?contentType=`. - All failures: 422 ProblemDetails, title `Validation failed` (contract-test entry added). No 404 surface. Includes handler + controller tests (310 total pass), regenerated `v1.json`. ## Adversarial review verdict One MAJOR (missing `#nullable enable` on the response DTO → spec documented nullable strings) — **fixed**, spec now emits plain `string`. Minors noted, deliberately deferred: bare 413 above Kestrel 30 MB limit (consistent app-wide), Location for logos points at the conditionally-authorized IPTV route, content-type trusted from client (parity with legacy; magic-byte sniffing = #66). Parity with the Blazor path verified: same cache, same dedup, same path conventions; API is stricter-validated than Blazor. fixes #104 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timothy added 1 commit 2026-07-03 23:32:42 +02:00
feat(api): artwork upload endpoint (#104)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 4m4s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 5m1s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
3d086aabc1
POST /api/artwork/uploads (multipart/form-data) accepting logo and
watermark images. Validates content type (png/jpeg/gif/webp) and size
(SystemEnvironment.MaximumUploadMb, default 10MB) mirroring the Blazor
upload path; stores via IImageCache.SaveArtworkToCache; returns
{ path, contentType } consumable by channel create/update.

Includes handler + controller tests, OpenAPI 422 contract-test entry,
and regenerated v1.json.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
timothy merged commit daf94f73f8 into main 2026-07-03 23:41:49 +02:00
Sign in to join this conversation.