diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs index f1428fe..2d7895e 100644 --- a/src/ReC.API/Controllers/RecActionController.cs +++ b/src/ReC.API/Controllers/RecActionController.cs @@ -12,14 +12,27 @@ namespace ReC.API.Controllers; [ApiController] public class RecActionController(IMediator mediator, IConfiguration config) : ControllerBase { + /// + /// Invokes a batch of RecActions for a given profile. + /// + /// The ID of the profile. + /// A token to cancel the operation. + /// An HTTP 202 Accepted response indicating the process has been started. [HttpPost("invoke/{profileId}")] + [ProducesResponseType(StatusCodes.Status202Accepted)] public async Task Invoke([FromRoute] int profileId, CancellationToken cancel) { await mediator.InvokeBatchRecAction(profileId, cancel); 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.InvokeBatchRecAction(config.GetFakeProfileId(), cancel); @@ -27,19 +40,39 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co } #region CRUD + /// + /// Gets all RecActions for a given profile. + /// + /// The ID of the profile. + /// A token to cancel the operation. + /// A list of RecActions for the specified profile. [HttpGet] + [ProducesResponseType(StatusCodes.Status200OK)] public async Task Get([FromQuery] long profileId, CancellationToken cancel) => Ok(await mediator.Send(new ReadRecActionQuery() { ProfileId = profileId }, 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) => Ok(await mediator.Send(new ReadRecActionQuery() { ProfileId = config.GetFakeProfileId() }, cancel)); + /// + /// Creates a new RecAction. + /// + /// The command containing the details for the new RecAction. + /// A token to cancel the operation. + /// An HTTP 201 Created response. [HttpPost] + [ProducesResponseType(StatusCodes.Status201Created)] public async Task CreateAction([FromBody] CreateRecActionCommand command, CancellationToken cancel) { await mediator.Send(command, cancel); @@ -47,7 +80,17 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co return CreatedAtAction(nameof(CreateAction), null); } + /// + /// Creates a new fake RecAction for testing purposes. + /// + /// A token to cancel the operation. + /// The optional request body and header for the fake action. + /// The target endpoint URI. + /// The optional path to append to the endpoint URI. + /// The HTTP method type (e.g., GET, POST). + /// An HTTP 201 Created response. [HttpPost("fake")] + [ProducesResponseType(StatusCodes.Status201Created)] public async Task CreateFakeAction( CancellationToken cancel, [FromBody] FakeRequest? request = null, @@ -75,7 +118,14 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co return CreatedAtAction(nameof(CreateFakeAction), null); } + /// + /// Deletes all RecActions associated with a specific profile. + /// + /// The ID of the profile whose RecActions should be deleted. + /// A token to cancel the operation. + /// An HTTP 204 No Content response upon successful deletion. [HttpDelete] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task Delete([FromQuery] int profileId, CancellationToken cancel) { await mediator.Send(new DeleteRecActionsCommand() @@ -86,7 +136,13 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co return NoContent(); } + /// + /// Deletes all RecActions for a fake/test profile. + /// + /// 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.Send(new DeleteRecActionsCommand()