feat: 商户类目数据库化并增加权限种子
This commit is contained in:
@@ -50,6 +50,8 @@ public sealed class TakeoutAppDbContext(
|
||||
public DbSet<MerchantDocument> MerchantDocuments => Set<MerchantDocument>();
|
||||
public DbSet<MerchantContract> MerchantContracts => Set<MerchantContract>();
|
||||
public DbSet<MerchantStaff> MerchantStaff => Set<MerchantStaff>();
|
||||
public DbSet<MerchantAuditLog> MerchantAuditLogs => Set<MerchantAuditLog>();
|
||||
public DbSet<MerchantCategory> MerchantCategories => Set<MerchantCategory>();
|
||||
|
||||
public DbSet<Store> Stores => Set<Store>();
|
||||
public DbSet<StoreBusinessHour> StoreBusinessHours => Set<StoreBusinessHour>();
|
||||
@@ -144,6 +146,8 @@ public sealed class TakeoutAppDbContext(
|
||||
ConfigureMerchantDocument(modelBuilder.Entity<MerchantDocument>());
|
||||
ConfigureMerchantContract(modelBuilder.Entity<MerchantContract>());
|
||||
ConfigureMerchantStaff(modelBuilder.Entity<MerchantStaff>());
|
||||
ConfigureMerchantAuditLog(modelBuilder.Entity<MerchantAuditLog>());
|
||||
ConfigureMerchantCategory(modelBuilder.Entity<MerchantCategory>());
|
||||
ConfigureStoreBusinessHour(modelBuilder.Entity<StoreBusinessHour>());
|
||||
ConfigureStoreHoliday(modelBuilder.Entity<StoreHoliday>());
|
||||
ConfigureStoreDeliveryZone(modelBuilder.Entity<StoreDeliveryZone>());
|
||||
@@ -499,6 +503,27 @@ public sealed class TakeoutAppDbContext(
|
||||
builder.HasIndex(x => new { x.TenantId, x.MerchantId, x.Phone });
|
||||
}
|
||||
|
||||
private static void ConfigureMerchantAuditLog(EntityTypeBuilder<MerchantAuditLog> builder)
|
||||
{
|
||||
builder.ToTable("merchant_audit_logs");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.MerchantId).IsRequired();
|
||||
builder.Property(x => x.Title).HasMaxLength(128).IsRequired();
|
||||
builder.Property(x => x.Description).HasMaxLength(1024);
|
||||
builder.Property(x => x.OperatorName).HasMaxLength(64);
|
||||
builder.HasIndex(x => new { x.TenantId, x.MerchantId });
|
||||
}
|
||||
|
||||
private static void ConfigureMerchantCategory(EntityTypeBuilder<MerchantCategory> builder)
|
||||
{
|
||||
builder.ToTable("merchant_categories");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
builder.Property(x => x.DisplayOrder).HasDefaultValue(0);
|
||||
builder.Property(x => x.IsActive).IsRequired();
|
||||
builder.HasIndex(x => new { x.TenantId, x.Name }).IsUnique();
|
||||
}
|
||||
|
||||
private static void ConfigureStoreBusinessHour(EntityTypeBuilder<StoreBusinessHour> builder)
|
||||
{
|
||||
builder.ToTable("store_business_hours");
|
||||
|
||||
Reference in New Issue
Block a user