Add Delete method for fake profile in OutResController
Added a new `Delete` method to the `OutResController` class to delete all output results for a fake/test profile. The method is accessible via the `DELETE /fake` route and supports cancellation via a `CancellationToken`. Included XML documentation for the method, describing its purpose, parameters, and return type. Added `[ProducesResponseType]` attributes to specify possible HTTP response codes: `204 No Content` for success and `400 Bad Request` for invalid requests. The method uses `IMediator` to send a `DeleteOutResCommand` with a `ProfileId` obtained from the `IConfiguration` instance.
This commit is contained in:
parent
1cdd28738a
commit
404a1c4793
@ -71,6 +71,20 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
|||||||
await mediator.Send(command, cancel);
|
await mediator.Send(command, cancel);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes all output results for a fake/test profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancel">A token to cancel the operation.</param>
|
||||||
|
/// <returns>An empty response indicating success.</returns>
|
||||||
|
[HttpDelete("fake")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<IActionResult> Delete(CancellationToken cancel)
|
||||||
|
{
|
||||||
|
await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel);
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user