Apply retention to refined replay originals

RetentionDays (0-365, default 7) sets OriginalsExpireAt from the end of
the live, or from publication with 0 days. The replay worker purges the
segments, source and draft of published emissions and deletes emissions
never published by the deadline, marking their flow deleted. Owners can
purge published originals early with DELETE podcasts/{id}/originals.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-16 14:36:45 +00:00
commit e9ffbc78be
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
17 changed files with 5618 additions and 27 deletions

View file

@ -21,7 +21,7 @@ namespace Yavsc.Services
Task<bool> AcceptStream (HttpContext context, ApplicationUser user, string destDir, string fileName);
Task<PodcastResponse> CreateAsync(string ownerId, string ownerName, string title, CancellationToken ct,
Guid? id = null, bool refineReplay = false);
Guid? id = null, bool refineReplay = false, int retentionDays = PodcastRetention.DefaultDays);
Task<IReadOnlyList<PodcastResponse>> ListAsync(CancellationToken ct);
Task<PodcastManifestResponse> GetAsync(Guid id, CancellationToken ct);
Task<PodcastResponse> AppendAsync(Guid id, string ownerId, int sequence,
@ -36,6 +36,13 @@ namespace Yavsc.Services
Task<PodcastResponse> PublishDraftAsync(Guid id, string ownerId, int revision, CancellationToken ct);
Task<Stream> OpenDraftSourceAsync(Guid id, string ownerId, CancellationToken ct);
Task<bool> PublishNextDraftAsync(IPodcastReplayEditor editor, CancellationToken ct);
/// <summary>Deletes the originals and draft of a published refined replay; the MP4 remains.</summary>
Task<PodcastResponse> DeleteOriginalsAsync(Guid id, string ownerId, CancellationToken ct);
/// <summary>
/// Applies the retention of refined replays: purges the originals of published ones and deletes
/// the emissions never published before their deadline, which are returned.
/// </summary>
Task<IReadOnlyList<PodcastResponse>> PurgeExpiredOriginalsAsync(CancellationToken ct);
Task DeleteAsync(Guid id, string ownerId, CancellationToken ct);
}