feat: add permission hierarchy tree

This commit is contained in:
2025-12-06 11:53:14 +08:00
parent d34f92ea1d
commit 37dc23f0c1
16 changed files with 1014 additions and 2 deletions

View File

@@ -141,12 +141,16 @@ public sealed class IdentityDbContext(
builder.ToTable("permissions");
builder.HasKey(x => x.Id);
builder.Property(x => x.TenantId).IsRequired();
builder.Property(x => x.ParentId).IsRequired();
builder.Property(x => x.SortOrder).IsRequired();
builder.Property(x => x.Type).HasMaxLength(16).IsRequired();
builder.Property(x => x.Name).HasMaxLength(64).IsRequired();
builder.Property(x => x.Code).HasMaxLength(128).IsRequired();
builder.Property(x => x.Description).HasMaxLength(256);
ConfigureAuditableEntity(builder);
ConfigureSoftDeleteEntity(builder);
builder.HasIndex(x => x.TenantId);
builder.HasIndex(x => new { x.TenantId, x.ParentId, x.SortOrder });
builder.HasIndex(x => new { x.TenantId, x.Code }).IsUnique();
}