Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 6s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 10s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 21s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 13m34s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 15m21s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 16m19s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 19m36s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 19m37s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Independent review found a blocker + two mediums: - BLOCKER: SearchSmartCollections/SearchMultiCollections (the scheduling collection picker) didn't filter OwnedByChannelId, so a user could select a system-owned auto-tune artifact into their own schedule item — a later channel delete would then cascade-delete that schedule item (ProgramScheduleItem-> MultiCollection is OnDelete(Cascade)). Both handlers now exclude owned rows; regression test added (CollectionPickerHidesOwnedTests). - MEDIUM: TryStampOwnership now runs on CancellationToken.None (post-commit convention #254) and stamps the MC + member SmartCollections in one transaction, so a late cancel or mid-way failure can't leave a permanent orphan / list leak. - Documented the movie-remainder weight clamp bound (>1000 un-touched movies can't express the exact ratio — the 1..1000 weight-column bound from #70). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
1.2 KiB
C#
28 lines
1.2 KiB
C#
using ErsatzTV.Application.MediaCollections;
|
|
using ErsatzTV.Infrastructure.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using static ErsatzTV.Application.MediaCollections.Mapper;
|
|
|
|
namespace ErsatzTV.Application.Search;
|
|
|
|
public class SearchMultiCollectionsHandler(IDbContextFactory<TvContext> dbContextFactory)
|
|
: IRequestHandler<SearchMultiCollections, List<MultiCollectionViewModel>>
|
|
{
|
|
public async Task<List<MultiCollectionViewModel>> Handle(
|
|
SearchMultiCollections request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
|
|
return await dbContext.MultiCollections
|
|
.AsNoTracking()
|
|
// Hide system-owned auto-tune weighted artifacts (#425) from the scheduling picker: selecting one
|
|
// into a user schedule would let a later channel delete cascade away that schedule item.
|
|
.Where(mc => mc.OwnedByChannelId == null)
|
|
.Where(mc => EF.Functions.Like(mc.Name, $"%{request.Query}%"))
|
|
.OrderBy(mc => mc.Name)
|
|
.Take(10)
|
|
.ToListAsync(cancellationToken)
|
|
.Map(list => list.Map(ProjectToViewModel).ToList());
|
|
}
|
|
}
|