forked from gongxuegit/tiku-backend.net
feat: add content navigation and tenant configuration
This commit is contained in:
@@ -51,3 +51,61 @@ internal sealed class TenantMembershipConfiguration : IEntityTypeConfiguration<T
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantDomainConfiguration : IEntityTypeConfiguration<TenantDomain>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantDomain> builder)
|
||||
{
|
||||
builder.ConfigureTenantEntity("tenant_domains");
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.Host).HasColumnType("citext").HasMaxLength(253);
|
||||
builder.Property(entity => entity.DomainType).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.Property(entity => entity.VerificationToken).HasMaxLength(256);
|
||||
builder.HasIndex(entity => entity.Host).IsUnique();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.IsPrimary })
|
||||
.IsUnique()
|
||||
.HasFilter("is_primary");
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantBrandingConfiguration : IEntityTypeConfiguration<TenantBranding>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantBranding> builder)
|
||||
{
|
||||
builder.ToTable("tenant_branding");
|
||||
builder.HasKey(entity => entity.TenantId);
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.BrandName).HasMaxLength(200);
|
||||
builder.Property(entity => entity.ShortName).HasMaxLength(100);
|
||||
builder.Property(entity => entity.Slogan).HasMaxLength(300);
|
||||
builder.Property(entity => entity.OrganizationName).HasMaxLength(300);
|
||||
builder.Property(entity => entity.LogoUrl).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.FaviconUrl).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.ServiceWechat).HasMaxLength(100);
|
||||
builder.Property(entity => entity.ServiceAccountName).HasMaxLength(200);
|
||||
builder.Property(entity => entity.Theme).IsJson("{}");
|
||||
builder.Property(entity => entity.PublicAssets).IsJson("{}");
|
||||
|
||||
builder.HasOne<Tenant>().WithOne()
|
||||
.HasForeignKey<TenantBranding>(entity => entity.TenantId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TenantSettingsConfiguration : IEntityTypeConfiguration<TenantSettings>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TenantSettings> builder)
|
||||
{
|
||||
builder.ToTable("tenant_settings");
|
||||
builder.HasKey(entity => entity.TenantId);
|
||||
builder.ConfigureTimestamps();
|
||||
builder.Property(entity => entity.FeatureFlags).IsJson("{}");
|
||||
builder.Property(entity => entity.AdminFeatureFlags).IsJson("{}");
|
||||
builder.Property(entity => entity.PublicConfig).IsJson("{}");
|
||||
|
||||
builder.HasOne<Tenant>().WithOne()
|
||||
.HasForeignKey<TenantSettings>(entity => entity.TenantId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user