Delete backtest by request id

This commit is contained in:
2025-07-18 19:34:16 +07:00
parent cb031522b4
commit fd117f9a2f
5 changed files with 39 additions and 1 deletions

View File

@@ -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>