diff --git a/src/Workflow.Domain/Entities/FormComponentRegistry.cs b/src/Workflow.Domain/Entities/FormComponentRegistry.cs new file mode 100644 index 0000000..43bc13a --- /dev/null +++ b/src/Workflow.Domain/Entities/FormComponentRegistry.cs @@ -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; } +} diff --git a/src/Workflow.Infrastructure/Persistence/Configurations/FormComponentRegistryConfiguration.cs b/src/Workflow.Infrastructure/Persistence/Configurations/FormComponentRegistryConfiguration.cs new file mode 100644 index 0000000..61221ca --- /dev/null +++ b/src/Workflow.Infrastructure/Persistence/Configurations/FormComponentRegistryConfiguration.cs @@ -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 +{ + public void Configure(EntityTypeBuilder 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); + } +} diff --git a/src/Workflow.Infrastructure/Persistence/WorkflowDbContext.cs b/src/Workflow.Infrastructure/Persistence/WorkflowDbContext.cs index a929805..77e7e1a 100644 --- a/src/Workflow.Infrastructure/Persistence/WorkflowDbContext.cs +++ b/src/Workflow.Infrastructure/Persistence/WorkflowDbContext.cs @@ -17,8 +17,8 @@ public class WorkflowDbContext : DbContext public DbSet WorkflowTokens => Set(); public DbSet WorkflowTasks => Set(); public DbSet FormDefinitions => Set(); - public DbSet FormDefinitionFields => Set(); public DbSet FormData => Set(); + public DbSet FormComponentRegistries => Set(); public WorkflowDbContext(DbContextOptions options) : base(options) { }