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.
19 lines
757 B
19 lines
757 B
using ErsatzTV.Infrastructure.Data; |
|
using ErsatzTV.Infrastructure.Extensions; |
|
using Microsoft.EntityFrameworkCore; |
|
|
|
namespace ErsatzTV.Application.MediaItems; |
|
|
|
public class GetRemoteStreamByIdHandler(IDbContextFactory<TvContext> dbContextFactory) |
|
: IRequestHandler<GetRemoteStreamById, Option<RemoteStreamViewModel>> |
|
{ |
|
public async Task<Option<RemoteStreamViewModel>> Handle( |
|
GetRemoteStreamById request, |
|
CancellationToken cancellationToken) |
|
{ |
|
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken); |
|
return await dbContext.RemoteStreams |
|
.SelectOneAsync(rs => rs.Id, rs => rs.Id == request.RemoteStreamId) |
|
.MapT(Mapper.ProjectToViewModel); |
|
} |
|
}
|
|
|