Added new BumperEndpoints to the API for managing bumper templates and variants, enhancing the channel management capabilities. Removed outdated bumper-related commands and handlers from the application, streamlining the codebase and improving maintainability. Updated ChannelEndpoints to reflect these changes and ensure proper routing for the new endpoints.
25 lines
975 B
C#
25 lines
975 B
C#
using LiteCqrs;
|
|
using TeleWave.Application.Common.Interfaces;
|
|
using TeleWave.Application.Common.Models;
|
|
using TeleWave.Domain.Broadcast;
|
|
|
|
namespace TeleWave.Application.Broadcast.Bumpers;
|
|
|
|
public sealed class CreateBumperTemplateCommandHandler(IAppDbContext dbContext)
|
|
: ICommandHandler<CreateBumperTemplateCommand, Result<Guid>>
|
|
{
|
|
private const string DefaultVariantName = "Текст 1";
|
|
|
|
public Task<Result<Guid>> Handle(
|
|
CreateBumperTemplateCommand command,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
var template = BumperTemplate.Create(command.Name, DefaultVariantName);
|
|
// Пустой блок в редакторе выглядит поломанным — новый начинается с «Сейчас / Далее».
|
|
template.Variants[0].SetLines(BumperTemplateLoader.DefaultLines());
|
|
dbContext.BumperTemplates.Add(template);
|
|
return Task.FromResult(Result.Success(template.Id));
|
|
}
|
|
}
|