From 1cdd28738a755a6d549bf57d4397ae570c8caefd Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 8 Dec 2025 11:47:05 +0100 Subject: [PATCH] Add Delete endpoint to OutResController Added a new HTTP DELETE endpoint to the OutResController to allow deletion of output results based on criteria provided in the DeleteOutResCommand. The endpoint supports cancellation via a CancellationToken and returns a 204 No Content response on success. Updated using directives to include necessary namespaces for commands and queries. Added response type annotations for better API documentation. --- src/ReC.API/Controllers/OutResController.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ReC.API/Controllers/OutResController.cs b/src/ReC.API/Controllers/OutResController.cs index 3f15be6..eff3b6e 100644 --- a/src/ReC.API/Controllers/OutResController.cs +++ b/src/ReC.API/Controllers/OutResController.cs @@ -1,6 +1,7 @@ using MediatR; using Microsoft.AspNetCore.Mvc; using ReC.API.Extensions; +using ReC.Application.OutResults.Commands; using ReC.Application.OutResults.Queries; namespace ReC.API.Controllers; @@ -55,6 +56,21 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr _ => Ok(res), }; } + + /// + /// Deletes output results based on the provided criteria. + /// + /// The command containing the deletion criteria, such as ActionId or ProfileId. + /// A token to cancel the operation. + /// An empty response indicating success. + [HttpDelete] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + public async Task Delete([FromQuery] DeleteOutResCommand command, CancellationToken cancel) + { + await mediator.Send(command, cancel); + return NoContent(); + } } ///