feat(product): complete combo and detail editing data model
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 47s
This commit is contained in:
@@ -233,6 +233,14 @@ public sealed class TakeoutAppDbContext(
|
||||
/// </summary>
|
||||
public DbSet<ProductSku> ProductSkus => Set<ProductSku>();
|
||||
/// <summary>
|
||||
/// 套餐分组。
|
||||
/// </summary>
|
||||
public DbSet<ProductComboGroup> ProductComboGroups => Set<ProductComboGroup>();
|
||||
/// <summary>
|
||||
/// 套餐分组商品。
|
||||
/// </summary>
|
||||
public DbSet<ProductComboGroupItem> ProductComboGroupItems => Set<ProductComboGroupItem>();
|
||||
/// <summary>
|
||||
/// 加料分组。
|
||||
/// </summary>
|
||||
public DbSet<ProductAddonGroup> ProductAddonGroups => Set<ProductAddonGroup>();
|
||||
@@ -477,6 +485,8 @@ public sealed class TakeoutAppDbContext(
|
||||
ConfigureProductSchedule(modelBuilder.Entity<ProductSchedule>());
|
||||
ConfigureProductScheduleProduct(modelBuilder.Entity<ProductScheduleProduct>());
|
||||
ConfigureProductSku(modelBuilder.Entity<ProductSku>());
|
||||
ConfigureProductComboGroup(modelBuilder.Entity<ProductComboGroup>());
|
||||
ConfigureProductComboGroupItem(modelBuilder.Entity<ProductComboGroupItem>());
|
||||
ConfigureProductAddonGroup(modelBuilder.Entity<ProductAddonGroup>());
|
||||
ConfigureProductAddonOption(modelBuilder.Entity<ProductAddonOption>());
|
||||
ConfigureProductPricingRule(modelBuilder.Entity<ProductPricingRule>());
|
||||
@@ -747,6 +757,8 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.CoverImage).HasMaxLength(256);
|
||||
builder.Property(x => x.GalleryImages).HasMaxLength(1024);
|
||||
builder.Property(x => x.Description).HasColumnType("text");
|
||||
builder.Property(x => x.SortWeight).HasDefaultValue(0);
|
||||
builder.Property(x => x.PackingFee).HasPrecision(18, 2);
|
||||
builder.HasIndex(x => new { x.TenantId, x.StoreId });
|
||||
builder.HasIndex(x => new { x.TenantId, x.SpuCode }).IsUnique();
|
||||
}
|
||||
@@ -1308,9 +1320,35 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.Property(x => x.OriginalPrice).HasPrecision(18, 2);
|
||||
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.SkuCode }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductComboGroup(EntityTypeBuilder<ProductComboGroup> builder)
|
||||
{
|
||||
builder.ToTable("product_combo_groups");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
builder.Property(x => x.MinSelect).IsRequired();
|
||||
builder.Property(x => x.MaxSelect).IsRequired();
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId, x.SortOrder });
|
||||
builder.HasIndex(x => new { x.TenantId, x.ProductId, x.Name });
|
||||
}
|
||||
|
||||
private static void ConfigureProductComboGroupItem(EntityTypeBuilder<ProductComboGroupItem> builder)
|
||||
{
|
||||
builder.ToTable("product_combo_group_items");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.ComboGroupId).IsRequired();
|
||||
builder.Property(x => x.ProductId).IsRequired();
|
||||
builder.Property(x => x.Quantity).IsRequired();
|
||||
builder.Property(x => x.SortOrder).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.ComboGroupId, x.SortOrder });
|
||||
builder.HasIndex(x => new { x.TenantId, x.ComboGroupId, x.ProductId }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureProductAddonGroup(EntityTypeBuilder<ProductAddonGroup> builder)
|
||||
{
|
||||
builder.ToTable("product_addon_groups");
|
||||
|
||||
Reference in New Issue
Block a user