Security #1
@@ -0,0 +1,37 @@
|
|||||||
|
namespace PostFundManagement.Domain.Configuration;
|
||||||
|
|
||||||
|
public sealed class ComplianceItem : IEntityTypeConfiguration<Entities.ComplianceItem>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.ComplianceItem> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable(nameof(Entities.ComplianceItem).Pluralize());
|
||||||
|
|
||||||
|
builder.HasKey(pk => pk.Id);
|
||||||
|
builder.Property(f => f.ProjectId).IsRequired();
|
||||||
|
builder.Property(f => f.CreatedBy).IsRequired();
|
||||||
|
builder.Property(f => f.VerifiedBy).IsRequired(false);
|
||||||
|
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
||||||
|
builder.Property(f => f.UpdatedAt).IsRequired(false);
|
||||||
|
builder.Property(f => f.Title).IsRequired().HasMaxLength(256);
|
||||||
|
builder.Property(f => f.Requirements).IsRequired().HasMaxLength(2048);
|
||||||
|
builder.Property(f => f.Status).IsRequired().HasDefaultValue(ApprovalStatus.Pending);
|
||||||
|
|
||||||
|
builder.HasOne(f => f.Project)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.ProjectId)
|
||||||
|
.IsRequired()
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
builder.HasOne(f => f.Creator)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.CreatedBy)
|
||||||
|
.IsRequired()
|
||||||
|
.OnDelete(DeleteBehavior.NoAction);
|
||||||
|
|
||||||
|
builder.HasOne(f => f.Verifier)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.VerifiedBy)
|
||||||
|
.IsRequired(false)
|
||||||
|
.OnDelete(DeleteBehavior.NoAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PostFundManagement.Domain.Entities;
|
||||||
|
|
||||||
|
[EntityTypeConfiguration<Configuration.ComplianceItem, ComplianceItem>]
|
||||||
|
public class ComplianceItem : Models.ComplianceItem
|
||||||
|
{
|
||||||
|
public virtual Project? Project { get; set; }
|
||||||
|
|
||||||
|
public virtual User? Creator { get; set; }
|
||||||
|
|
||||||
|
public virtual User? Verifier { get; set; }
|
||||||
|
}
|
||||||
@@ -18,5 +18,5 @@ public class ComplianceItem
|
|||||||
|
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
|
|
||||||
public DateTime? VerifiedAt { get; set; }
|
public DateTime? UpdatedAt { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ namespace PostFundManagement.Infrastructure.Database;
|
|||||||
|
|
||||||
public sealed class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : DbContext(options)
|
public sealed class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : DbContext(options)
|
||||||
{
|
{
|
||||||
|
public DbSet<ComplianceItem> ComplianceItems => Set<ComplianceItem>();
|
||||||
|
|
||||||
public DbSet<Issue> Issues => Set<Issue>();
|
public DbSet<Issue> Issues => Set<Issue>();
|
||||||
|
|
||||||
public DbSet<Outcome> Outcomes => Set<Outcome>();
|
public DbSet<Outcome> Outcomes => Set<Outcome>();
|
||||||
|
|||||||
Reference in New Issue
Block a user