Browse and clean up the media library through the API
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 19:55:03 +02:00
parent 8d0f2e3639
commit 4c4a2b3299
10 changed files with 342 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ class MediaResource extends JsonResource
public function toArray(Request $request): array
{
return [
'id' => $this->id,
// What a record stores — `featured_image` on a page — and so the one
// field a caller has to keep.
'path' => $this->path,
@@ -30,6 +31,13 @@ class MediaResource extends JsonResource
// False until the queue has derived the smaller versions and the
// placeholder. The image serves either way.
'processed' => $this->isProcessed(),
'error' => $this->error,
// Only in the library, where it decides whether a file may go.
'referenced' => $this->when(
array_key_exists('referenced', $this->resource->getAttributes()),
fn () => (bool) $this->resource->getAttribute('referenced'),
),
'created_at' => $this->created_at?->toIso8601String(),
];
}
}