Implement BumperEndpoints and remove deprecated bumper-related functionality
ci / build-backend (push) Successful in 1m39s
ci / build-frontend (push) Failing after 26s
ci / tests (push) Skipped
ci / sonar (push) Skipped

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.
This commit is contained in:
Leonid Pershin
2026-07-27 22:01:56 +03:00
parent ee0b4d2d01
commit ba3721eb92
140 changed files with 7326 additions and 3609 deletions
@@ -2,37 +2,32 @@ namespace TeleWave.Domain.Broadcast;
/// <summary>
/// Подблок заставки (текст-вариант) внутри <see cref="BumperTemplate"/>. Наследует от блока звук,
/// стиль и фон, но задаёт собственный текст и правило показа (<see cref="Trigger"/>). Позволяет иметь
/// несколько текстов на одной музыке/оформлении, не дублируя блок.
/// стиль и шрифт, но задаёт собственный набор строк, фон и правило показа (<see cref="Trigger"/>).
/// Позволяет иметь несколько текстов на одной музыке/оформлении, не дублируя блок.
/// </summary>
public class BumperTextVariant
{
private readonly List<BumperLine> _lines = [];
public Guid Id { get; private set; }
public Guid BumperTemplateId { get; private set; }
public int Position { get; private set; }
public string Name { get; private set; } = string.Empty;
public BumperTextKind Kind { get; private set; }
// ── Режим NowNext: подписи (названия шоу подставляет генератор) ──
public string NowLabel { get; private set; } = DefaultNowLabel;
public string NextLabel { get; private set; } = DefaultNextLabel;
// ── Режим Free: произвольные строки (например название канала и совет) ──
public string Line1 { get; private set; } = string.Empty;
public string Line2 { get; private set; } = string.Empty;
public BumperTrigger Trigger { get; private set; }
/// <summary>Вес при стратегии <see cref="BumperSelection.WeightedRandom"/> (0 — не выбирается). Иначе игнорируется.</summary>
/// <summary>Источник картинки под текстом.</summary>
public BumperBackground Background { get; private set; }
/// <summary>Вес при выборе подблока на переходе (0 — не выбирается никогда).</summary>
public int Weight { get; private set; } = DefaultWeight;
public DateTimeOffset CreatedAt { get; private set; }
public const int DefaultWeight = 1;
public const string DefaultNowLabel = "СЕЙЧАС";
public const string DefaultNextLabel = "ДАЛЕЕ";
/// <summary>Строки в порядке показа сверху вниз.</summary>
public IReadOnlyList<BumperLine> Lines => _lines;
private BumperTextVariant() { }
@@ -48,28 +43,32 @@ public class BumperTextVariant
BumperTemplateId = bumperTemplateId,
Position = position,
Name = name,
Kind = BumperTextKind.NowNext,
NowLabel = DefaultNowLabel,
NextLabel = DefaultNextLabel,
Line1 = string.Empty,
Line2 = string.Empty,
Trigger = trigger,
Background = BumperBackground.NextPoster,
Weight = DefaultWeight,
CreatedAt = DateTimeOffset.UtcNow,
};
public void Update(string name, BumperTextContent text, BumperTrigger trigger, int weight)
public void Update(string name, BumperTrigger trigger, BumperBackground background, int weight)
{
Name = name;
Kind = text.Kind;
NowLabel = text.NowLabel;
NextLabel = text.NextLabel;
Line1 = text.Line1;
Line2 = text.Line2;
Trigger = trigger;
Background = background;
Weight = Math.Max(0, weight);
}
/// <summary>
/// Заменяет набор строк целиком. Построчных команд намеренно нет: редактор всегда знает весь
/// список, а порядок задаётся перетаскиванием — три команды вместо одной ничего бы не дали.
/// </summary>
public void SetLines(IEnumerable<BumperLine> lines)
{
_lines.Clear();
var position = 0;
foreach (var line in lines)
_lines.Add(BumperLine.Create(position++, line.Style, line.Color, line.Text));
}
/// <summary>Подходит ли подблок для перехода: <paramref name="isShowChange"/> — сменилось ли шоу.</summary>
public bool Matches(bool isShowChange) =>
Trigger switch