Skip to content

Commit

Permalink
refactor: rename to attached annexes
Browse files Browse the repository at this point in the history
  • Loading branch information
meaboutsoftware committed Apr 13, 2024
1 parent 66d6b69 commit 12a2cb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class BindingContract : Entity
public DateTimeOffset TerminatedAt { get; set; }
public DateTimeOffset BindingFrom { get; init; }
public DateTimeOffset ExpiringAt { get; init; }
public ICollection<Annex> RegisteredAnnexes { get; }
public ICollection<Annex> AttachedAnnexes { get; }

private BindingContract(
ContractId contractId,
Expand All @@ -31,7 +31,7 @@ private BindingContract(
Duration = duration;
ExpiringAt = expiringAt;
BindingFrom = bindingFrom;
RegisteredAnnexes = [];
AttachedAnnexes = [];

var @event = BindingContractStartedEvent.Raise(BindingFrom, ExpiringAt);
RecordEvent(@event);
Expand All @@ -49,7 +49,7 @@ public void AttachAnnex(DateTimeOffset validFrom, DateTimeOffset now)
BusinessRuleValidator.Validate(
new AnnexCanOnlyBeAddedOnlyBeAddedToActiveBindingContractRule(TerminatedAt, ExpiringAt, now));

RegisteredAnnexes.Add(Annex.Attach(Id, validFrom));
AttachedAnnexes.Add(Annex.Attach(Id, validFrom));
}

public void Terminate(DateTimeOffset terminatedAt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Configure(EntityTypeBuilder<BindingContract> builder)
builder.Property(contract => contract.BindingFrom).IsRequired();
builder.Property(contract => contract.ExpiringAt).IsRequired();

builder.OwnsMany<Annex>(nameof(BindingContract.RegisteredAnnexes), annex =>
builder.OwnsMany<Annex>(nameof(BindingContract.AttachedAnnexes), annex =>
{
annex.WithOwner().HasForeignKey(a => a.BindingContractId);
annex.ToTable("Annexes");
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 12a2cb7

Please sign in to comment.