Migrated portfolio to be linked to the organisation
This commit is contained in:
@@ -9,12 +9,19 @@ public sealed class Portfolio : IEntityTypeConfiguration<Domain.Entities.Portfol
|
||||
builder.ToTable(nameof(Domain.Entities.Portfolio).Pluralize());
|
||||
|
||||
builder.HasKey(pk => pk.Id);
|
||||
builder.Property(f => f.OrganisationId).IsRequired();
|
||||
builder.Property(f => f.CreatedBy).IsRequired();
|
||||
builder.Property(f => f.OwnedBy).IsRequired();
|
||||
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
|
||||
builder.Property(f => f.Name).IsRequired().HasMaxLength(LabelLength);
|
||||
builder.Property(f => f.Description).IsRequired(false).HasMaxLength(TextLength);
|
||||
|
||||
builder.HasOne(f => f.Organisation)
|
||||
.WithMany()
|
||||
.HasForeignKey(fk => fk.OrganisationId)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
builder.HasOne(f => f.Creator)
|
||||
.WithMany()
|
||||
.HasForeignKey(fk => fk.CreatedBy)
|
||||
|
||||
@@ -7,5 +7,7 @@ public class Portfolio : Models.Portfolio
|
||||
|
||||
public virtual User? Owner { get; set; }
|
||||
|
||||
public virtual Organisation? Organisation { get; set; }
|
||||
|
||||
public virtual ICollection<Programme> Programmes { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ public class Portfolio
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public long OrganisationId { get; set; }
|
||||
|
||||
public Guid OwnedBy { get; set; }
|
||||
|
||||
public Guid CreatedBy { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user