разные правки по беку

This commit is contained in:
gorbenko.pavel
2026-08-17 15:33:54 +05:00
parent 2a7130c37f
commit b92897254d
23 changed files with 475 additions and 315 deletions
@@ -7,7 +7,7 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence;
public class ApprovalRouteDbContext(DbContextOptions<ApprovalRouteDbContext> options) : DbContext(options)
{
public DbSet<RequestType> RequestTypes => Set<RequestType>();
public DbSet<RequestTypeList> RequestTypeLists => Set<RequestTypeList>();
public DbSet<RequestListPartition> RequestListPartitions => Set<RequestListPartition>();
public DbSet<TemplateRoute> TemplateRoutes => Set<TemplateRoute>();
public DbSet<TemplateRouteStep> TemplateRouteSteps => Set<TemplateRouteStep>();
public DbSet<AppSetting> Settings => Set<AppSetting>();
@@ -34,13 +34,12 @@ public class ApprovalRouteDbContext(DbContextOptions<ApprovalRouteDbContext> opt
e.Property(x => x.Section).HasMaxLength(256).IsRequired();
});
modelBuilder.Entity<RequestTypeList>(e =>
modelBuilder.Entity<RequestListPartition>(e =>
{
e.HasKey(x => x.Id);
e.Property(x => x.SiteUrl).HasMaxLength(512).IsRequired();
e.Property(x => x.ListId).HasMaxLength(512).IsRequired();
e.Property(x => x.Title).HasMaxLength(512);
e.HasOne(x => x.RequestType).WithMany(x => x.Lists).HasForeignKey(x => x.RequestTypeId);
e.HasOne(x => x.RequestType).WithMany(x => x.ListPartitions).HasForeignKey(x => x.RequestTypeId);
// Номер уникален в пределах типа заявок — вторая попытка записать тот же
// номер (например, при двойном запуске задачи) упадёт на этом индексе,
// а не создаст в реестре дубль.