Skip to content

Commit

Permalink
feat: add node to timeline when creating new node
Browse files Browse the repository at this point in the history
  • Loading branch information
HunorTotBagi committed Feb 5, 2025
1 parent a248750 commit 3296a66
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using BuildingBlocks.Application.Data;
using BuildingBlocks.Domain.Nodes.Node.ValueObjects;
using Nodes.Application.Data.Abstractions;

namespace Nodes.Application.Entities.Nodes.Commands.CreateNode;

internal class CreateNodeHandler(INodesDbContext dbContext) : ICommandHandler<CreateNodeCommand, CreateNodeResult>
internal class CreateNodeHandler(INodesDbContext dbContext, ITimelinesService timelineService) : ICommandHandler<CreateNodeCommand, CreateNodeResult>
{
public async Task<CreateNodeResult> Handle(CreateNodeCommand command, CancellationToken cancellationToken)
{
Expand All @@ -12,6 +13,8 @@ public async Task<CreateNodeResult> Handle(CreateNodeCommand command, Cancellati
dbContext.Nodes.Add(node);
await dbContext.SaveChangesAsync(cancellationToken);

await timelineService.AddNode(node.TimelineId, node.Id, cancellationToken);

return new CreateNodeResult(node.Id);
}
}
Expand Down

0 comments on commit 3296a66

Please sign in to comment.