feat: 商品SKU支持异步保存与软禁用替换策略
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 56s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 56s
This commit is contained in:
@@ -233,6 +233,10 @@ public sealed class TakeoutAppDbContext(
|
||||
/// </summary>
|
||||
public DbSet<ProductSku> ProductSkus => Set<ProductSku>();
|
||||
/// <summary>
|
||||
/// SKU 异步保存任务。
|
||||
/// </summary>
|
||||
public DbSet<ProductSkuSaveJob> ProductSkuSaveJobs => Set<ProductSkuSaveJob>();
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public DbSet<ProductComboGroup> ProductComboGroups => Set<ProductComboGroup>();
|
||||
@@ -485,6 +489,7 @@ public sealed class TakeoutAppDbContext(
|
||||
ConfigureProductSchedule(modelBuilder.Entity<ProductSchedule>());
|
||||
ConfigureProductScheduleProduct(modelBuilder.Entity<ProductScheduleProduct>());
|
||||
ConfigureProductSku(modelBuilder.Entity<ProductSku>());
|
||||
ConfigureProductSkuSaveJob(modelBuilder.Entity<ProductSkuSaveJob>());
|
||||
ConfigureProductComboGroup(modelBuilder.Entity<ProductComboGroup>());
|
||||
ConfigureProductComboGroupItem(modelBuilder.Entity<ProductComboGroupItem>());
|
||||
ConfigureProductAddonGroup(modelBuilder.Entity<ProductAddonGroup>());
|
||||
@@ -1321,9 +1326,28 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.Weight).HasPrecision(10, 3);
|
||||
builder.Property(x => x.AttributesJson).HasColumnType("text");
|
||||
builder.Property(x => x.IsEnabled).HasDefaultValue(true);
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId });
|
||||
builder.HasIndex(x => new { x.TenantId, x.SkuCode }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductSkuSaveJob(EntityTypeBuilder<ProductSkuSaveJob> builder)
|
||||
{
|
||||
builder.ToTable("product_sku_save_jobs");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.StoreId).IsRequired();
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.Property(x => x.Status).HasConversion<int>();
|
||||
builder.Property(x => x.Mode).HasMaxLength(16).IsRequired();
|
||||
builder.Property(x => x.PayloadJson).HasColumnType("text").IsRequired();
|
||||
builder.Property(x => x.ProgressTotal).IsRequired();
|
||||
builder.Property(x => x.ProgressProcessed).IsRequired();
|
||||
builder.Property(x => x.FailedCount).IsRequired();
|
||||
builder.Property(x => x.ErrorMessage).HasMaxLength(2000);
|
||||
builder.Property(x => x.HangfireJobId).HasMaxLength(64);
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId, x.CreatedAt });
|
||||
builder.HasIndex(x => new { x.TenantId, x.Status, x.CreatedAt });
|
||||
}
|
||||
|
||||
private static void ConfigureProductComboGroup(EntityTypeBuilder<ProductComboGroup> builder)
|
||||
{
|
||||
builder.ToTable("product_combo_groups");
|
||||
|
||||
Reference in New Issue
Block a user