diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs
index bdf2107..9bfebdf 100644
--- a/src/ReC.API/Controllers/RecActionController.cs
+++ b/src/ReC.API/Controllers/RecActionController.cs
@@ -1,10 +1,9 @@
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ReC.API.Extensions;
-using ReC.API.Models;
+using ReC.Application.Common.Procedures.InsertProcedure;
using ReC.Application.RecActions.Commands;
using ReC.Application.RecActions.Queries;
-using System.Text.Json;
namespace ReC.API.Controllers;
@@ -72,51 +71,11 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
/// An HTTP 201 Created response.
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
- [Obsolete("Use the related procedure.")]
- public async Task CreateAction([FromBody] CreateRecActionCommand command, CancellationToken cancel)
+ public async Task CreateAction([FromBody] InsertActionProcedure command, CancellationToken cancel)
{
- await mediator.Send(command, cancel);
+ await mediator.ExecuteInsertProcedure(command, config["AddedWho"], cancel);
- return CreatedAtAction(nameof(CreateAction), null);
- }
-
- ///
- /// Creates a new fake RecAction for testing purposes.
- ///
- /// A token to cancel the operation.
- /// The optional request body and header for the fake action.
- /// The target endpoint URI.
- /// The optional path to append to the endpoint URI.
- /// The HTTP method type (e.g., GET, POST).
- /// An HTTP 201 Created response.
- [HttpPost("fake")]
- [ProducesResponseType(StatusCodes.Status201Created)]
- [Obsolete("Use the related procedure.")]
- public async Task CreateFakeAction(
- CancellationToken cancel,
- [FromBody] FakeRequest? request = null,
- [FromQuery] string endpointUri = "https://jsonplaceholder.typicode.com/posts",
- [FromQuery] string? endpointPath = "1",
- [FromQuery] string type = "GET")
- {
- if (endpointPath is not null)
- endpointUri = new Uri(new Uri(endpointUri.TrimEnd('/') + "/"), endpointPath.TrimStart('/')).ToString();
-
- var bodyJson = request?.Body is not null ? JsonSerializer.Serialize(request.Body, options: new() { WriteIndented = false }) : null;
- var headerJson = request?.Header is not null ? JsonSerializer.Serialize(request.Header, options: new() { WriteIndented = false }) : null;
-
- await mediator.Send(new CreateRecActionCommand()
- {
- ProfileId = config.GetFakeProfileId(),
- EndpointUri = endpointUri,
- Type = type,
- BodyQuery = $@"SELECT '{bodyJson ?? "NULL"}' AS REQUEST_BODY;",
- HeaderQuery = headerJson is not null ? $@"SELECT '{headerJson}' AS REQUEST_HEADER;" : null,
- Active = true,
- EndpointAuthId = 4
- }, cancel);
-
- return CreatedAtAction(nameof(CreateFakeAction), null);
+ return StatusCode(StatusCodes.Status201Created);
}
///