diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs index 42cdb8d..3880f77 100644 --- a/src/ReC.API/Controllers/RecActionController.cs +++ b/src/ReC.API/Controllers/RecActionController.cs @@ -1,8 +1,5 @@ using MediatR; using Microsoft.AspNetCore.Mvc; -using ReC.Application.Common.Procedures.DeleteProcedure; -using ReC.Application.Common.Procedures.InsertProcedure; -using ReC.Application.Common.Procedures.UpdateProcedure; using ReC.Application.RecActions.Commands; using ReC.Application.RecActions.Queries; @@ -10,19 +7,19 @@ namespace ReC.API.Controllers; [Route("api/[controller]")] [ApiController] -public class RecActionController(IMediator mediator, IConfiguration config) : ControllerBase +public class RecActionController(IMediator mediator) : ControllerBase { /// /// Invokes a batch of RecActions for a given profile. /// - /// The ID of the profile. + /// The command containing the profile ID. /// A token to cancel the operation. /// An HTTP 202 Accepted response indicating the process has been started. - [HttpPost("invoke/{profileId}")] + [HttpPost("invoke/{command}")] [ProducesResponseType(StatusCodes.Status202Accepted)] - public async Task Invoke([FromRoute] int profileId, CancellationToken cancel) + public async Task Invoke([FromRoute] InvokeBatchRecActionViewsCommand command, CancellationToken cancel) { - await mediator.InvokeBatchRecActionView(profileId, cancel); + await mediator.Send(command, cancel); return Accepted(); } @@ -47,7 +44,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status201Created)] public async Task Create([FromBody] InsertActionProcedure command, CancellationToken cancel) { - await mediator.ExecuteInsertProcedure(command, config["AddedWho"], cancel); + await mediator.Send(command, cancel); return StatusCode(StatusCodes.Status201Created); } @@ -55,15 +52,14 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co /// /// Updates a RecAction via the ACTION update procedure. /// - /// RecAction identifier to update. /// UpdateActionProcedure payload. /// A token to cancel the operation. /// No content on success. [HttpPut("{id:long}")] [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task Update([FromRoute] long id, [FromBody] UpdateActionProcedure procedure, CancellationToken cancel) + public async Task Update([FromBody] UpdateActionProcedure procedure, CancellationToken cancel) { - await mediator.ExecuteUpdateProcedure(procedure, id, cancel: cancel); + await mediator.Send(procedure, cancel); return NoContent(); } @@ -77,7 +73,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task Delete([FromBody] DeleteActionProcedure procedure, CancellationToken cancel) { - await mediator.ExecuteDeleteProcedure(procedure, cancel); + await mediator.Send(procedure, cancel); return NoContent(); } #endregion CRUD