Files
ersatztv/ErsatzTV/Controllers/Api/Requests/ReplaceRemoteLibraryPreferencesRequest.cs
T
timothy 295004ab12 feat(api): add media-source write API shared DTOs (#202 slice S0)
Response DTOs (ErsatzTV.Core/Api/MediaSources) and request DTOs
(ErsatzTV/Controllers/Api/Requests) per the #202 design doc §B — the
shared shapes that backend slices S1 (local libraries), S2 (Plex), and
S3 (Jellyfin/Emby) will consume. No controllers or handler changes;
DTOs are unused so far.

Notable: RemoteConnectionResponseModel deliberately never carries the
raw API key (secure connection contract); SaveRemoteConnectionRequest's
To{Jellyfin,Emby}Command(existingApiKey) retains the existing key when
the incoming ApiKey is blank/omitted.

No conventions changed; nothing to update in docs/api-conventions.md.
2026-07-11 15:23:14 +02:00

30 lines
1.2 KiB
C#

using ErsatzTV.Application.Emby;
using ErsatzTV.Application.Jellyfin;
using ErsatzTV.Application.Plex;
namespace ErsatzTV.Controllers.Api.Requests;
// Shared by Plex/Jellyfin/Emby (design #202 §C4a) — the PUT body is the complete set of the
// source's libraries; a row absent from the request is left untouched, not deleted. The controller
// validates the id set against that source's known libraries before dispatch.
public record ReplaceRemoteLibraryPreferencesRequest(List<RemoteLibraryPreferenceRequest> Libraries)
{
public UpdatePlexLibraryPreferences ToPlexCommand() =>
new(
(Libraries ?? [])
.Select(item => new PlexLibraryPreference(item.Id, item.ShouldSyncItems))
.ToList());
public UpdateJellyfinLibraryPreferences ToJellyfinCommand() =>
new(
(Libraries ?? [])
.Select(item => new JellyfinLibraryPreference(item.Id, item.ShouldSyncItems))
.ToList());
public UpdateEmbyLibraryPreferences ToEmbyCommand() =>
new(
(Libraries ?? [])
.Select(item => new EmbyLibraryPreference(item.Id, item.ShouldSyncItems))
.ToList());
}