From 82de285891580e1c0e2ca08ed1f40b3fd56147fe Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 16 Jan 2026 09:18:15 +0100 Subject: [PATCH] Refactor OutResController to use DeleteResultProcedure Refactored DELETE endpoints in OutResController to use the new DeleteResultProcedure payload instead of DeleteOutResCommand. Updated endpoints to call mediator.ExecuteDeleteProcedure and revised XML docs accordingly. Removed obsolete attributes and command references. The "fake" profile deletion now uses the procedure with the fake profile ID. --- src/ReC.API/Controllers/OutResController.cs | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ReC.API/Controllers/OutResController.cs b/src/ReC.API/Controllers/OutResController.cs index a526c00..8c62564 100644 --- a/src/ReC.API/Controllers/OutResController.cs +++ b/src/ReC.API/Controllers/OutResController.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc; using ReC.API.Extensions; using ReC.API.Models; -using ReC.Application.OutResults.Commands; +using ReC.Application.Common.Procedures.DeleteProcedure; using ReC.Application.OutResults.Queries; namespace ReC.API.Controllers; @@ -59,32 +59,36 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr } /// - /// Deletes output results based on the provided criteria. + /// Deletes RESULT records via the delete procedure for the specified id range. /// - /// The command containing the deletion criteria, such as ActionId or ProfileId. + /// DeleteResultProcedure payload (Start, End, Force). /// A token to cancel the operation. - /// An empty response indicating success. + /// No content on success. [HttpDelete] [ProducesResponseType(StatusCodes.Status204NoContent)] - [Obsolete("Use the related procedure or view.")] - public async Task Delete([FromQuery] DeleteOutResCommand command, CancellationToken cancel) + public async Task Delete([FromBody] DeleteResultProcedure procedure, CancellationToken cancel) { - await mediator.Send(command, cancel); + await mediator.ExecuteDeleteProcedure(procedure, cancel); return NoContent(); } /// - /// Deletes all output results for a fake/test profile. + /// Deletes RESULT records for a fake/test profile via the delete procedure. /// /// A token to cancel the operation. - /// An empty response indicating success. + /// No content on success. [HttpDelete("fake")] [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - [Obsolete("Use the related procedure or view.")] public async Task Delete(CancellationToken cancel) { - await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel); + await mediator.ExecuteDeleteProcedure(new DeleteResultProcedure + { + Start = config.GetFakeProfileId(), + End = config.GetFakeProfileId(), + Force = false + }, cancel); + return NoContent(); } } \ No newline at end of file