Skip to content

Commit

Permalink
handle span equipment merged event
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-dax committed Apr 16, 2024
1 parent 9294af4 commit 606b4fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OpenFTTH.RelationalProjector/RelationalDatabaseProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public RelationalDatabaseProjection(ILogger<RelationalDatabaseProjection> logger
ProjectEventAsync<SpanEquipmentAffixedToParent>(Project);
ProjectEventAsync<SpanEquipmentDetachedFromParent>(Project);
ProjectEventAsync<SpanEquipmentAddressInfoChanged>(Project);
ProjectEventAsync<SpanEquipmentMerged>(Project);

// Span equipment specification events
ProjectEventAsync<SpanEquipmentSpecificationAdded>(Project);
Expand Down Expand Up @@ -150,6 +151,10 @@ private Task Project(IEventEnvelope eventEnvelope)
ApplyStateChanges(_state.ProcessSpanEquipmentDetachedFromParent(@event));
break;

case (SpanEquipmentMerged @event):
ApplyStateChanges(_state.ProcessSpanEquipmentMerged(@event));
break;


// Span equipment specification events
case (SpanEquipmentSpecificationAdded @event):
Expand Down
8 changes: 8 additions & 0 deletions OpenFTTH.RelationalProjector/State/ProjektorState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ public List<ObjectState> ProcessSpanEquipmentMoved(SpanEquipmentMoved @event)
return stateChanges;
}

public List<ObjectState> ProcessSpanEquipmentMerged(SpanEquipmentMerged @event)
{
// The logic should be applied as with move
return ProcessSpanEquipmentMoved(
new SpanEquipmentMoved(@event.SpanEquipmentId, @event.NodesOfInterestIds)
);
}

public List<ObjectState> ProcessSpanEquipmentRemoved(Guid spanEquipmentId)
{
List<ObjectState> stateChanges = new List<ObjectState>();
Expand Down

0 comments on commit 606b4fe

Please sign in to comment.