Add broadcast scheduling features: implement Show and Channel entities, enhance AppDbContext and DependencyInjection for broadcasting, and update API routing. Include migration for new database schema and update documentation for broadcast-related functionalities.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
using LiteCqrs;
|
||||
|
||||
namespace TeleWave.Application.Broadcast.ListChannels;
|
||||
|
||||
public sealed record ListChannelsQuery : IQuery<IReadOnlyList<ChannelSummaryDto>>;
|
||||
@@ -0,0 +1,20 @@
|
||||
using LiteCqrs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
|
||||
namespace TeleWave.Application.Broadcast.ListChannels;
|
||||
|
||||
public sealed class ListChannelsQueryHandler(IAppDbContext dbContext)
|
||||
: IQueryHandler<ListChannelsQuery, IReadOnlyList<ChannelSummaryDto>>
|
||||
{
|
||||
public async Task<IReadOnlyList<ChannelSummaryDto>> Handle(
|
||||
ListChannelsQuery query,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
return await dbContext.Channels.AsNoTracking()
|
||||
.OrderBy(c => c.Name)
|
||||
.Select(c => new ChannelSummaryDto(c.Id, c.Name, c.Slug, c.IsEnabled))
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user