From 3e6c2ea12b6ebf6655d753107f3d7b7e369278a7 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 3 Dec 2025 13:03:50 +0100 Subject: [PATCH] Add repository interaction to CreateRecActionCommandHandler Updated `CreateRecActionCommandHandler` to include a repository dependency (`IRepository`) for persisting data. Added a call to `repo.CreateAsync` in the `Handle` method to save the command request. Updated `using` directives to include necessary dependencies (`AutoMapper`, `DigitalData.Core.Abstraction.Application.Repository`, and `ReC.Domain.Entities`). Validation logic for `EndpointId` or `EndpointUri` remains unchanged. --- .../RecActions/Commands/CreateRecActionCommand.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs index c074fae..e83ef01 100644 --- a/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs +++ b/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs @@ -1,6 +1,8 @@ -using DigitalData.Core.Exceptions; +using DigitalData.Core.Abstraction.Application.Repository; +using DigitalData.Core.Exceptions; using MediatR; using ReC.Application.Endpoints.Commands; +using ReC.Domain.Entities; namespace ReC.Application.RecActions.Commands; @@ -21,7 +23,7 @@ public record CreateRecActionCommand : IRequest public string BodyQuery { get; init; } = null!; } -public class CreateRecActionCommandHandler(ISender sender) : IRequestHandler +public class CreateRecActionCommandHandler(ISender sender, IRepository repo) : IRequestHandler { public async Task Handle(CreateRecActionCommand request, CancellationToken cancel) { @@ -33,5 +35,7 @@ public class CreateRecActionCommandHandler(ISender sender) : IRequestHandler