mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
940 B
22 lines
940 B
using ErsatzTV.Core.Api.SmartCollections; |
|
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Infrastructure.Data; |
|
using Microsoft.EntityFrameworkCore; |
|
using static ErsatzTV.Application.MediaCollections.Mapper; |
|
|
|
namespace ErsatzTV.Application.MediaCollections; |
|
|
|
public class GetAllSmartCollectionsForApiHandler(IDbContextFactory<TvContext> dbContextFactory) |
|
: IRequestHandler<GetAllSmartCollectionsForApi, List<SmartCollectionResponseModel>> |
|
{ |
|
public async Task<List<SmartCollectionResponseModel>> Handle( |
|
GetAllSmartCollectionsForApi request, |
|
CancellationToken cancellationToken) |
|
{ |
|
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken); |
|
List<SmartCollection> ffmpegProfiles = await dbContext.SmartCollections |
|
.AsNoTracking() |
|
.ToListAsync(cancellationToken); |
|
return ffmpegProfiles.Map(ProjectToResponseModel).ToList(); |
|
} |
|
}
|
|
|