Add more errors
This commit is contained in:
@@ -47,6 +47,7 @@ public class DataController : ControllerBase
|
||||
/// <param name="accountService">Service for account management.</param>
|
||||
/// <param name="cacheService">Service for caching data.</param>
|
||||
/// <param name="statisticService">Service for statistical analysis.</param>
|
||||
/// <param name="agentService">Service for agents</param>
|
||||
/// <param name="hubContext">SignalR hub context for real-time communication.</param>
|
||||
/// <param name="mediator">Mediator for handling commands and queries.</param>
|
||||
/// <param name="tradingService">Service for trading operations.</param>
|
||||
@@ -451,6 +452,11 @@ public class DataController : ControllerBase
|
||||
[HttpGet("GetUserStrategies")]
|
||||
public async Task<ActionResult<List<UserStrategyDetailsViewModel>>> GetUserStrategies(string agentName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(agentName))
|
||||
{
|
||||
return BadRequest("Agent name cannot be null or empty.");
|
||||
}
|
||||
|
||||
// Get all strategies for the specified user
|
||||
var userStrategies = await _mediator.Send(new GetUserStrategiesCommand(agentName));
|
||||
|
||||
@@ -476,6 +482,16 @@ public class DataController : ControllerBase
|
||||
[HttpGet("GetUserStrategy")]
|
||||
public async Task<ActionResult<UserStrategyDetailsViewModel>> GetUserStrategy(string agentName, string strategyName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(agentName))
|
||||
{
|
||||
return BadRequest("Agent name cannot be null or empty.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(strategyName))
|
||||
{
|
||||
return BadRequest("Strategy name cannot be null or empty.");
|
||||
}
|
||||
|
||||
// Get the specific strategy for the user
|
||||
var strategy = await _mediator.Send(new GetUserStrategyCommand(agentName, strategyName));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user