diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs index 9bfebdf..d626636 100644 --- a/src/ReC.API/Controllers/RecActionController.cs +++ b/src/ReC.API/Controllers/RecActionController.cs @@ -1,7 +1,9 @@ using MediatR; using Microsoft.AspNetCore.Mvc; using ReC.API.Extensions; +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; @@ -79,33 +81,48 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co } /// - /// Deletes all RecActions associated with a specific profile. + /// Updates a RecAction via the ACTION update procedure. /// - /// + /// RecAction identifier to update. + /// UpdateActionProcedure payload. /// A token to cancel the operation. - /// An HTTP 204 No Content response upon successful deletion. - [HttpDelete] + /// No content on success. + [HttpPut("{id:long}")] [ProducesResponseType(StatusCodes.Status204NoContent)] - [Obsolete("Use the related procedure.")] - public async Task Delete([FromQuery] DeleteRecActionsCommand cmd, CancellationToken cancel) + public async Task UpdateAction([FromRoute] long id, [FromBody] UpdateActionProcedure procedure, CancellationToken cancel) { - await mediator.Send(cmd, cancel); + await mediator.ExecuteUpdateProcedure(procedure, id, cancel: cancel); return NoContent(); } /// - /// Deletes all RecActions for a fake/test profile. + /// Deletes RecActions via the ACTION delete procedure for the specified id range. + /// + /// DeleteActionProcedure payload (Start, End, Force). + /// A token to cancel the operation. + /// An HTTP 204 No Content response upon successful deletion. + [HttpDelete] + [ProducesResponseType(StatusCodes.Status204NoContent)] + public async Task Delete([FromBody] DeleteActionProcedure procedure, CancellationToken cancel) + { + await mediator.ExecuteDeleteProcedure(procedure, cancel); + return NoContent(); + } + + /// + /// Deletes RecActions for a fake/test profile via the ACTION delete procedure. /// /// A token to cancel the operation. /// An HTTP 204 No Content response upon successful deletion. [HttpDelete("fake")] [ProducesResponseType(StatusCodes.Status204NoContent)] - [Obsolete("Use the related procedure.")] public async Task Delete(CancellationToken cancel) { - await mediator.Send(new DeleteRecActionsCommand() + await mediator.ExecuteDeleteProcedure(new DeleteActionProcedure { - ProfileId = config.GetFakeProfileId() + Start = config.GetFakeProfileId(), + End = config.GetFakeProfileId(), + Force = false }, cancel); return NoContent();