Skip to content

Commit

Permalink
chore: Fix onDelete behaviour for RelatedTransmissions (#949)
Browse files Browse the repository at this point in the history
Missed this during the introduction of Transmissions
  • Loading branch information
oskogstad authored Jul 31, 2024
1 parent 1b6f371 commit 061046a
Show file tree
Hide file tree
Showing 6 changed files with 1,822 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ public class DialogTransmission : IImmutableEntity

public Uri? ExtendedType { get; set; }

public DialogTransmissionType.Values TypeId { get; set; }
public DialogTransmissionType Type { get; set; } = null!;

// === Principal relationships ===
public List<TransmissionContent> Content { get; set; } = [];

public List<TransmissionAttachment> Attachments { get; set; } = [];
public List<DialogTransmission> RelatedTransmissions { get; set; } = [];

// === Dependent relationships ===
public Guid DialogId { get; set; }
public DialogEntity Dialog { get; set; } = null!;

public Guid? RelatedTransmissionId { get; set; }
public DialogTransmission? RelatedTransmission { get; set; }

public DialogTransmissionType.Values TypeId { get; set; }
public DialogTransmissionType Type { get; set; } = null!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@ public void Configure(EntityTypeBuilder<DialogActivity> builder)
builder.HasOne(x => x.RelatedActivity)
.WithMany(x => x.RelatedActivities)
.OnDelete(DeleteBehavior.SetNull);
// TODO: Rename in https://github.com/digdir/dialogporten/issues/860
// builder.HasOne(x => x.Transmission)
// .WithMany(x => x.Activities)
// .OnDelete(DeleteBehavior.SetNull);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities.Transmissions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Configurations.Dialogs.Transmissions;

internal sealed class DialogTransmissionConfiguration : IEntityTypeConfiguration<DialogTransmission>
{
public void Configure(EntityTypeBuilder<DialogTransmission> builder)
{
builder.HasOne(x => x.RelatedTransmission)
.WithMany(x => x.RelatedTransmissions)
.OnDelete(DeleteBehavior.SetNull);
}
}
Loading

0 comments on commit 061046a

Please sign in to comment.