Refactor RecAction invoke endpoint to use profileId param
Changed the HTTP POST route to accept a profileId instead of a command object, updated XML documentation accordingly, and refactored the method to construct the command internally using the provided profileId before sending it to the mediator. This improves clarity and API usability.
This commit is contained in:
@@ -13,14 +13,14 @@ public class RecActionController(IMediator mediator) : ControllerBase
|
||||
/// <summary>
|
||||
/// Invokes a batch of RecActions for a given profile.
|
||||
/// </summary>
|
||||
/// <param name="command">The command containing the profile ID.</param>
|
||||
/// <param name="profileId">The identifier of the profile whose RecActions should be invoked.</param>
|
||||
/// <param name="cancel">A token to cancel the operation.</param>
|
||||
/// <returns>An HTTP 202 Accepted response indicating the process has been started.</returns>
|
||||
[HttpPost("invoke/{command}")]
|
||||
[HttpPost("invoke/{profileId}")]
|
||||
[ProducesResponseType(StatusCodes.Status202Accepted)]
|
||||
public async Task<IActionResult> Invoke([FromRoute] InvokeBatchRecActionViewsCommand command, CancellationToken cancel)
|
||||
public async Task<IActionResult> Invoke([FromRoute] long profileId, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(command, cancel);
|
||||
await mediator.Send(new InvokeBatchRecActionViewsCommand { ProfileId = profileId }, cancel);
|
||||
return Accepted();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user