Added disbursement entity
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
namespace PostFundManagement.Domain.Configuration;
|
||||
|
||||
public sealed class Disbursement : IEntityTypeConfiguration<Entities.Disbursement>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Entities.Disbursement> builder)
|
||||
{
|
||||
builder.ToTable(nameof(Entities.Disbursement).Pluralize());
|
||||
|
||||
builder.HasKey(pk => pk.Id);
|
||||
builder.Property(f => f.ProjectId).IsRequired();
|
||||
builder.Property(f => f.MilestoneId).IsRequired(false);
|
||||
builder.Property(f => f.CreatedBy).IsRequired();
|
||||
builder.Property(f => f.UpdatedBy).IsRequired(false);
|
||||
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
||||
builder.Property(f => f.UpdatedAt).IsRequired(false);
|
||||
builder.Property(f => f.Amount).IsRequired().HasPrecision(18, 2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace PostFundManagement.Domain.Entities;
|
||||
|
||||
[EntityTypeConfiguration<Configuration.Contract, Contract>]
|
||||
public class Contract : Models.Contract
|
||||
{
|
||||
public virtual Award? Award { get; set; }
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace PostFundManagement.Domain.Entities;
|
||||
|
||||
[EntityTypeConfiguration<Configuration.Disbursement, Disbursement>]
|
||||
public class Disbursement : Models.Disbursement
|
||||
{
|
||||
public virtual Project? Project { get; set; }
|
||||
|
||||
public virtual Milestone? Milestone { get; set; }
|
||||
|
||||
public virtual User? Creator { get; set; }
|
||||
|
||||
public virtual User? Updator { get; set; }
|
||||
}
|
||||
@@ -97,7 +97,8 @@ public enum ApprovalStatus : int
|
||||
Pending = 1,
|
||||
Review = 2,
|
||||
Approved = 3,
|
||||
Rejected = 4
|
||||
Rejected = 4,
|
||||
Removed = 5
|
||||
}
|
||||
|
||||
public enum ActivityStatus : int
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace PostFundManagement.Infrastructure.Database;
|
||||
|
||||
public sealed class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : DbContext(options)
|
||||
{
|
||||
public DbSet<Disbursement> Disbursements => Set<Disbursement>();
|
||||
|
||||
public DbSet<Milestone> Milestones => Set<Milestone>();
|
||||
|
||||
public DbSet<Budget> Budgets => Set<Budget>();
|
||||
|
||||
Reference in New Issue
Block a user