feat: add FormComponentRegistry entity and EF configuration

This commit is contained in:
向宁 2026-05-25 14:05:58 +08:00
parent 293b23958f
commit 37ca47c5ea
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,21 @@
using Workflow.Domain.Common;
namespace Workflow.Domain.Entities;
public class FormComponentRegistry : BaseEntity, IFullAudit
{
public string Name { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public string DefaultSchema { get; set; } = string.Empty;
public string SupportedProps { get; set; } = "{}";
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; }
public Guid CreatedBy { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public Guid UpdatedBy { get; set; }
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public bool IsDeleted { get; set; }
public string? OperatorIP { get; set; }
}

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Workflow.Domain.Entities;
namespace Workflow.Infrastructure.Persistence.Configurations;
public class FormComponentRegistryConfiguration : IEntityTypeConfiguration<FormComponentRegistry>
{
public void Configure(EntityTypeBuilder<FormComponentRegistry> builder)
{
builder.ToTable("wf_form_component_registry");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedNever();
builder.Property(e => e.Name).HasMaxLength(100).IsRequired();
builder.Property(e => e.DisplayName).HasMaxLength(100).IsRequired();
builder.Property(e => e.Category).HasMaxLength(50).IsRequired();
builder.Property(e => e.Icon).HasMaxLength(100).IsRequired();
builder.Property(e => e.DefaultSchema).HasColumnType("jsonb").IsRequired();
builder.Property(e => e.SupportedProps).HasColumnType("jsonb").IsRequired();
builder.Property(e => e.OperatorIP).HasMaxLength(500);
builder.HasIndex(e => e.Name).IsUnique();
builder.HasIndex(e => e.Category);
}
}

View File

@ -17,8 +17,8 @@ public class WorkflowDbContext : DbContext
public DbSet<WorkflowToken> WorkflowTokens => Set<WorkflowToken>();
public DbSet<WorkflowTask> WorkflowTasks => Set<WorkflowTask>();
public DbSet<FormDefinition> FormDefinitions => Set<FormDefinition>();
public DbSet<FormDefinitionField> FormDefinitionFields => Set<FormDefinitionField>();
public DbSet<FormData> FormData => Set<FormData>();
public DbSet<FormComponentRegistry> FormComponentRegistries => Set<FormComponentRegistry>();
public WorkflowDbContext(DbContextOptions<WorkflowDbContext> options) : base(options) { }