From a62923c8d677a281aeef02a89b19c4d69840ba24 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 4 Dec 2025 14:07:17 +0100 Subject: [PATCH] Enhance OutResController with new features and docs Added XML documentation to `OutResController` methods for clarity. Introduced `ResultType` enum to specify result parts (Full, Header, Body). Enhanced `Get` methods to support fake/test profiles and actions. Added `[ProducesResponseType(StatusCodes.Status200OK)]` for explicit response status codes. Updated `Get` overloads for various scenarios. Utilized `config.GetFakeProfileId()` for dynamic fake profile handling. --- src/ReC.API/Controllers/OutResController.cs | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/ReC.API/Controllers/OutResController.cs b/src/ReC.API/Controllers/OutResController.cs index bef2d26..3f15be6 100644 --- a/src/ReC.API/Controllers/OutResController.cs +++ b/src/ReC.API/Controllers/OutResController.cs @@ -9,16 +9,37 @@ namespace ReC.API.Controllers; [ApiController] public class OutResController(IMediator mediator, IConfiguration config) : ControllerBase { + /// + /// Gets output results based on the provided query parameters. + /// + /// The query to filter output results. + /// A token to cancel the operation. + /// A list of output results matching the query. [HttpGet] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get([FromQuery] ReadOutResQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel)); + /// + /// Gets output results for a fake/test profile. + /// + /// A token to cancel the operation. + /// A list of output results for the fake profile. [HttpGet("fake")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadOutResQuery() { ProfileId = config.GetFakeProfileId() }, cancel)); + /// + /// Gets a specific output result for a fake/test profile and action. + /// + /// The ID of the action to retrieve the result for. + /// A token to cancel the operation. + /// Specifies which part of the result to return (Full, Header, or Body). + /// The requested output result or a part of it (header/body). [HttpGet("fake/{actionId}")] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get([FromRoute] long actionId, CancellationToken cancel, ResultType resultType = ResultType.Full) { var res = (await mediator.Send(new ReadOutResQuery() @@ -36,9 +57,21 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr } } +/// +/// Defines the type of result to be returned from an output result query. +/// public enum ResultType { + /// + /// Return the full result object. + /// Full, + /// + /// Return only the header part of the result. + /// Header, + /// + /// Return only the body part of the result. + /// Body }