Update scheduling parameters and refactor channel endpoints: extend HorizonDays to 7 and RetentionDays to 90 in appsettings.json. Consolidate channel-related endpoint logic by removing obsolete files and enhancing the ShowEndpoints with audience and genre management capabilities. Improve error handling and streamline command handlers for channel operations.
build / backend (push) Successful in 7m40s
build / frontend (push) Failing after 39s
tests / backend-tests (push) Successful in 6m9s

This commit is contained in:
Leonid Pershin
2026-07-26 13:32:13 +03:00
parent c4ef954dea
commit 66040a8841
272 changed files with 27944 additions and 8699 deletions
@@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TeleWave.Domain.Library;
namespace TeleWave.Infrastructure.Persistence.Configurations;
public class GenreConfiguration : IEntityTypeConfiguration<Genre>
{
public void Configure(EntityTypeBuilder<Genre> builder)
{
builder.Property(x => x.Name).IsRequired().HasMaxLength(128);
builder.Property(x => x.Slug).IsRequired().HasMaxLength(64);
builder.HasIndex(x => x.Slug).IsUnique();
builder
.HasMany(x => x.Aliases)
.WithOne()
.HasForeignKey(a => a.GenreId)
.OnDelete(DeleteBehavior.Cascade);
builder.Navigation(x => x.Aliases).UsePropertyAccessMode(PropertyAccessMode.Field);
}
}
public class GenreAliasConfiguration : IEntityTypeConfiguration<GenreAlias>
{
public void Configure(EntityTypeBuilder<GenreAlias> builder)
{
builder.Property(x => x.Value).IsRequired().HasMaxLength(128);
// Псевдоним однозначно указывает на жанр: иначе сопоставление метаданных стало бы неопределённым.
builder.HasIndex(x => x.Value).IsUnique();
}
}
public class ShowGenreConfiguration : IEntityTypeConfiguration<ShowGenre>
{
public void Configure(EntityTypeBuilder<ShowGenre> builder)
{
builder.HasKey(x => new { x.ShowId, x.GenreId });
builder.HasIndex(x => x.GenreId);
// Restrict, а не Cascade: удаление жанра из справочника не должно молча снимать его со всех шоу.
// Команда удаления проверяет использование заранее и возвращает управляемый конфликт.
builder
.HasOne<Genre>()
.WithMany()
.HasForeignKey(x => x.GenreId)
.OnDelete(DeleteBehavior.Restrict);
}
}