feat(plex): Collections Phase 2 — admin collection editing (write-back to Plex)

Admins can curate Plex collections from a movie's info page ("Collections"
button → PlexCollectionEditor dialog): create a collection (seeded with the
movie), add/remove the movie to/from editable collections, delete a collection,
and "take over" an existing plain Plex collection (mark it editable). All writes
go to Plex (POST/PUT/DELETE via new PlexClient methods) and are reflected on
every client; a targeted single-collection re-sync (sync.resync_collection /
delete_collection_local) updates the local mirror without the full ~4-min sync.

Gating (per the design decisions): editing is ADMIN-ONLY (collections are shared
library-wide); only plain manual collections are editable — smart + external
auto-lists (IMDb/TMDb/…) are always read-only (can_edit = editable && !smart &&
source=="collection"). New admin endpoints under /api/plex/collections
(create/items add+remove/rename/delete/editable). Verified end-to-end incl. the
live Plex write API (create/add/rename/remove/delete all 200, self-cleaned) and
the editor UI (create + delete with confirm) on localdev.
This commit is contained in:
npeter83 2026-07-06 17:33:16 +02:00
parent 4b053a55da
commit 8291f06525
12 changed files with 602 additions and 13 deletions

View file

@ -146,6 +146,7 @@ export default function PlexBrowse({ q, onClearSearch, library, show, sort, filt
return (
<PlexInfoView
id={infoId}
library={library}
onBack={sub.back}
onPlay={() => sub.open({ kind: "player", id: infoId })}
onPlayItem={(id) => sub.open({ kind: "player", id })}
@ -366,12 +367,14 @@ function PlexPosterCard({
function PlexInfoView({
id,
library,
onBack,
onPlay,
onPlayItem,
onFilter,
}: {
id: string;
library: string;
onBack: () => void;
onPlay: () => void;
onPlayItem: (id: string) => void;
@ -397,9 +400,11 @@ function PlexInfoView({
<PlexInfo
detail={q.data}
variant="page"
library={library}
onPlay={onPlay}
onPlayItem={onPlayItem}
onFilter={onFilter}
onStateChange={() => q.refetch()}
/>
</Suspense>
)}