Delete backtest by request id
This commit is contained in:
@@ -500,6 +500,7 @@ public class BacktestController : BaseController
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a specific genetic request by ID for the authenticated user.
|
||||
/// Also deletes all related backtests associated with this genetic request.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the genetic request to delete.</param>
|
||||
/// <returns>An ActionResult indicating the outcome of the operation.</returns>
|
||||
@@ -508,8 +509,17 @@ public class BacktestController : BaseController
|
||||
public async Task<ActionResult> DeleteGeneticRequest(string id)
|
||||
{
|
||||
var user = await GetUser();
|
||||
|
||||
// First, delete the genetic request
|
||||
_geneticService.DeleteGeneticRequestByIdForUser(user, id);
|
||||
return Ok();
|
||||
|
||||
// Then, delete all related backtests
|
||||
var backtestsDeleted = _backtester.DeleteBacktestsByRequestId(id);
|
||||
|
||||
return Ok(new {
|
||||
GeneticRequestDeleted = true,
|
||||
RelatedBacktestsDeleted = backtestsDeleted
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user