Security #1
@@ -0,0 +1,45 @@
|
|||||||
|
namespace PostFundManagement.Domain.Configuration;
|
||||||
|
|
||||||
|
public sealed class Evidence : IEntityTypeConfiguration<Entities.Evidence>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Entities.Evidence> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable(nameof(Entities.Evidence).Pluralize());
|
||||||
|
|
||||||
|
builder.HasKey(f => f.Id);
|
||||||
|
builder.Property(f => f.ProjectId).IsRequired();
|
||||||
|
builder.Property(f => f.MilestoneId).IsRequired();
|
||||||
|
builder.Property(f => f.IndicatorId).IsRequired();
|
||||||
|
builder.Property(f => f.CreatedBy).IsRequired();
|
||||||
|
builder.Property(f => f.UpdatedBy).IsRequired();
|
||||||
|
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
||||||
|
builder.Property(f => f.UpdatedAt).IsRequired(false);
|
||||||
|
builder.Property(f => f.Version).IsRequired().HasDefaultValue(1);
|
||||||
|
builder.Property(f => f.DocumentUrl).IsRequired();
|
||||||
|
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.Milestone)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.MilestoneId)
|
||||||
|
.IsRequired(false)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
builder.HasOne(f => f.Creator)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.CreatedBy)
|
||||||
|
.IsRequired()
|
||||||
|
.OnDelete(DeleteBehavior.NoAction);
|
||||||
|
|
||||||
|
builder.HasOne(f => f.Updator)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(fk => fk.UpdatedBy)
|
||||||
|
.IsRequired(false)
|
||||||
|
.OnDelete(DeleteBehavior.NoAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace PostFundManagement.Domain.Entities;
|
||||||
|
|
||||||
|
[EntityTypeConfiguration<Configuration.Evidence, Evidence>]
|
||||||
|
public class Evidence : Models.Evidence
|
||||||
|
{
|
||||||
|
public virtual Project? Project { get; set; }
|
||||||
|
|
||||||
|
public virtual Milestone? Milestone { get; set; }
|
||||||
|
|
||||||
|
public virtual Indicator? Indicator { get; set; }
|
||||||
|
|
||||||
|
public virtual User? Creator { get; set; }
|
||||||
|
|
||||||
|
public virtual User? Updator { 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<Evidence> Evidences => Set<Evidence>();
|
||||||
|
|
||||||
public DbSet<Risk> Risks => Set<Risk>();
|
public DbSet<Risk> Risks => Set<Risk>();
|
||||||
|
|
||||||
public DbSet<Indicator> Indicators => Set<Indicator>();
|
public DbSet<Indicator> Indicators => Set<Indicator>();
|
||||||
|
|||||||
Reference in New Issue
Block a user