Delete backtest by id and with filters

This commit is contained in:
2025-07-11 22:05:46 +07:00
parent 9714da1eb9
commit 79f0cd20c1
9 changed files with 239 additions and 69 deletions

View File

@@ -103,6 +103,18 @@ public class BacktestController : BaseController
return Ok(_backtester.DeleteBacktestByUser(user, id));
}
/// <summary>
/// Deletes multiple backtests by their IDs for the authenticated user.
/// </summary>
/// <param name="request">The request containing the array of backtest IDs to delete.</param>
/// <returns>An ActionResult indicating the outcome of the operation.</returns>
[HttpDelete("multiple")]
public async Task<ActionResult> DeleteBacktests([FromBody] DeleteBacktestsRequest request)
{
var user = await GetUser();
return Ok(_backtester.DeleteBacktestsByIdsForUser(user, request.BacktestIds));
}
/// <summary>
/// Retrieves all backtests for a specific genetic request ID.
/// This endpoint is used to view the results of a genetic algorithm optimization.

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace Managing.Api.Models.Requests;
/// <summary>
/// Request model for deleting multiple backtests by their IDs
/// </summary>
public class DeleteBacktestsRequest
{
/// <summary>
/// Array of backtest IDs to delete
/// </summary>
[Required]
[MinLength(1, ErrorMessage = "At least one backtest ID must be provided")]
public string[] BacktestIds { get; set; } = Array.Empty<string>();
}