51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
|
|
namespace PostFundManagement.Domain.Configuration.Entities;
|
|
|
|
public sealed class Invite : IEntityTypeConfiguration<Domain.Entities.Invite>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Domain.Entities.Invite> builder)
|
|
{
|
|
builder.ToTable(nameof(Domain.Entities.Invite).Pluralize());
|
|
|
|
builder.HasKey(pk => pk.Id);
|
|
builder.Property(f => f.OrganisationId).IsRequired();
|
|
builder.Property(f => f.InvitedOrganisationId).IsRequired();
|
|
builder.Property(f => f.AwardId).IsRequired();
|
|
builder.Property(f => f.ContractId).IsRequired();
|
|
builder.Property(f => f.Recipient).IsRequired();
|
|
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.HasOne(f => f.Organisation)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.OrganisationId)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasOne(f => f.InvitedOrganisation)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.InvitedOrganisationId)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasOne(f => f.Award)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.AwardId)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasOne(f => f.Contract)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.ContractId)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasOne(f => f.RecipientUser)
|
|
.WithMany()
|
|
.HasForeignKey(fk => fk.Recipient)
|
|
.IsRequired()
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
}
|
|
} |