From 86f4e3141e40f0d1d636604c14d84891d922a0a0 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 21 Jan 2026 12:06:19 +0100 Subject: [PATCH] Remove all 'fake' profile endpoints from controllers Removed API endpoints for invoking, retrieving, and deleting RecActions and Results associated with fake/test profiles in RecActionController and ResultController. Only standard CRUD operations for real profiles are now exposed. --- .../Controllers/RecActionController.cs | 47 --------------- src/ReC.API/Controllers/ResultController.cs | 57 ------------------- 2 files changed, 104 deletions(-) diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs index a98d57c..42cdb8d 100644 --- a/src/ReC.API/Controllers/RecActionController.cs +++ b/src/ReC.API/Controllers/RecActionController.cs @@ -1,6 +1,5 @@ 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; @@ -27,19 +26,6 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co return Accepted(); } - /// - /// Invokes a batch of RecActions for a fake/test profile. - /// - /// A token to cancel the operation. - /// An HTTP 202 Accepted response indicating the process has been started. - [HttpPost("invoke/fake")] - [ProducesResponseType(StatusCodes.Status202Accepted)] - public async Task Invoke(CancellationToken cancel) - { - await mediator.InvokeBatchRecActionView(config.GetFakeProfileId(), cancel); - return Accepted(); - } - #region CRUD /// /// Gets all RecActions for a given profile. @@ -51,20 +37,6 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get([FromQuery] ReadRecActionViewQuery query, CancellationToken cancel) => Ok(await mediator.Send(query, cancel)); - /// - /// Gets all RecActions for a fake/test profile. - /// - /// A token to cancel the operation. - /// - /// A list of RecActions for the fake profile. - [HttpGet("fake")] - [ProducesResponseType(StatusCodes.Status200OK)] - public async Task Get(CancellationToken cancel, [FromQuery] bool invoked = false) => Ok(await mediator.Send(new ReadRecActionViewQuery() - { - ProfileId = config.GetFakeProfileId(), - Invoked = invoked - }, cancel)); - /// /// Creates a new RecAction. /// @@ -108,24 +80,5 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co 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)] - public async Task Delete(CancellationToken cancel) - { - await mediator.ExecuteDeleteProcedure(new DeleteActionProcedure - { - Start = config.GetFakeProfileId(), - End = config.GetFakeProfileId(), - Force = false - }, cancel); - - return NoContent(); - } #endregion CRUD } \ No newline at end of file diff --git a/src/ReC.API/Controllers/ResultController.cs b/src/ReC.API/Controllers/ResultController.cs index b17f1ef..805abd9 100644 --- a/src/ReC.API/Controllers/ResultController.cs +++ b/src/ReC.API/Controllers/ResultController.cs @@ -24,43 +24,6 @@ public class ResultController(IMediator mediator, IConfiguration config) : Contr [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get([FromQuery] ReadResultViewQuery 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 ReadResultViewQuery() - { - 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, OnlyHeader, or OnlyBody). - /// 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 ReadResultViewQuery() - { - ProfileId = config.GetFakeProfileId(), - ActionId = actionId - }, cancel)).First(); - - return resultType switch - { - ResultType.OnlyBody => res.Body is null ? NotFound() : Ok(res.Body.JsonToDynamic()), - ResultType.OnlyHeader => res.Header is null ? NotFound() : Ok(res.Header.JsonToDynamic()), - _ => Ok(res), - }; - } - /// /// Inserts a RESULT record via the insert procedure. /// @@ -103,24 +66,4 @@ public class ResultController(IMediator mediator, IConfiguration config) : Contr await mediator.ExecuteDeleteProcedure(procedure, cancel); return NoContent(); } - - /// - /// Deletes RESULT records for a fake/test profile via the delete procedure. - /// - /// A token to cancel the operation. - /// No content on success. - [HttpDelete("fake")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task Delete(CancellationToken cancel) - { - await mediator.ExecuteDeleteProcedure(new DeleteResultProcedure - { - Start = config.GetFakeProfileId(), - End = config.GetFakeProfileId(), - Force = false - }, cancel); - - return NoContent(); - } } \ No newline at end of file