Update OutResController to use ReadResultViewQuery

Switched GET endpoints to ReadResultViewQuery for modernized query handling. Removed [Obsolete] from the controller class, but added it to DELETE endpoints to mark them as deprecated. Updated "fake" profile GET endpoints to use the new query model and removed obsolete warnings from these methods.
This commit is contained in:
2026-01-14 15:10:20 +01:00
parent df2ebe0cc2
commit ad51e4b1eb

View File

@@ -7,7 +7,6 @@ using ReC.Application.OutResults.Queries;
namespace ReC.API.Controllers;
[Obsolete("This controller is deprecated and will be removed in future versions. Use the new ResultViewController instead.")]
[Route("api/[controller]")]
[ApiController]
public class OutResController(IMediator mediator, IConfiguration config) : ControllerBase
@@ -20,7 +19,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// <returns>A list of output results matching the query.</returns>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> Get([FromQuery] ReadOutResQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel));
public async Task<IActionResult> Get([FromQuery] ReadResultViewQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel));
/// <summary>
/// Gets output results for a fake/test profile.
@@ -29,8 +28,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// <returns>A list of output results for the fake profile.</returns>
[HttpGet("fake")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadOutResQuery()
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadResultViewQuery()
{
ProfileId = config.GetFakeProfileId()
}, cancel));
@@ -44,10 +42,9 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// <returns>The requested output result or a part of it (header/body).</returns>
[HttpGet("fake/{actionId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Get([FromRoute] long actionId, CancellationToken cancel, ResultType resultType = ResultType.Full)
{
var res = (await mediator.Send(new ReadOutResQuery()
var res = (await mediator.Send(new ReadResultViewQuery()
{
ProfileId = config.GetFakeProfileId(),
ActionId = actionId
@@ -69,6 +66,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// <returns>An empty response indicating success.</returns>
[HttpDelete]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Delete([FromQuery] DeleteOutResCommand command, CancellationToken cancel)
{
await mediator.Send(command, cancel);
@@ -83,6 +81,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
[HttpDelete("fake")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Delete(CancellationToken cancel)
{
await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel);