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.
This commit is contained in:
@@ -24,43 +24,6 @@ public class ResultController(IMediator mediator, IConfiguration config) : Contr
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
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.
|
||||
/// </summary>
|
||||
/// <param name="cancel">A token to cancel the operation.</param>
|
||||
/// <returns>A list of output results for the fake profile.</returns>
|
||||
[HttpGet("fake")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadResultViewQuery()
|
||||
{
|
||||
ProfileId = config.GetFakeProfileId()
|
||||
}, cancel));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific output result for a fake/test profile and action.
|
||||
/// </summary>
|
||||
/// <param name="actionId">The ID of the action to retrieve the result for.</param>
|
||||
/// <param name="cancel">A token to cancel the operation.</param>
|
||||
/// <param name="resultType">Specifies which part of the result to return (Full, OnlyHeader, or OnlyBody).</param>
|
||||
/// <returns>The requested output result or a part of it (header/body).</returns>
|
||||
[HttpGet("fake/{actionId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> 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),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a RESULT record via the insert procedure.
|
||||
/// </summary>
|
||||
@@ -103,24 +66,4 @@ public class ResultController(IMediator mediator, IConfiguration config) : Contr
|
||||
await mediator.ExecuteDeleteProcedure(procedure, cancel);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes RESULT records for a fake/test profile via the delete procedure.
|
||||
/// </summary>
|
||||
/// <param name="cancel">A token to cancel the operation.</param>
|
||||
/// <returns>No content on success.</returns>
|
||||
[HttpDelete("fake")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> Delete(CancellationToken cancel)
|
||||
{
|
||||
await mediator.ExecuteDeleteProcedure(new DeleteResultProcedure
|
||||
{
|
||||
Start = config.GetFakeProfileId(),
|
||||
End = config.GetFakeProfileId(),
|
||||
Force = false
|
||||
}, cancel);
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user