Remove doc required
This commit is contained in:
@@ -105,7 +105,7 @@ public class TradingController : BaseController
|
||||
public async Task<ActionResult<Position>> ClosePosition(Guid identifier)
|
||||
{
|
||||
var position = await _tradingService.GetPositionByIdentifierAsync(identifier);
|
||||
|
||||
|
||||
var result = await _closeTradeCommandHandler.Handle(new ClosePositionCommand(position, position.AccountId));
|
||||
return Ok(result);
|
||||
}
|
||||
@@ -190,7 +190,8 @@ public class TradingController : BaseController
|
||||
// Check if user has permission to initialize this address
|
||||
if (!await CanUserInitializeAddress(user.Name, publicAddress))
|
||||
{
|
||||
return Forbid("You don't have permission to initialize this wallet address. You can only initialize your own wallet addresses.");
|
||||
return Forbid(
|
||||
"You don't have permission to initialize this wallet address. You can only initialize your own wallet addresses.");
|
||||
}
|
||||
|
||||
var result = await _tradingService.InitPrivyWallet(publicAddress, TradingExchanges.GmxV2);
|
||||
@@ -228,19 +229,22 @@ public class TradingController : BaseController
|
||||
// Regular users can only initialize their own addresses
|
||||
// Check if the address belongs to one of the user's accounts
|
||||
var account = await _accountService.GetAccountByKey(publicAddress, true, false);
|
||||
|
||||
|
||||
if (account?.User?.Name == userName)
|
||||
{
|
||||
_logger.LogInformation("User {UserName} initializing their own address {Address}", userName, publicAddress);
|
||||
_logger.LogInformation("User {UserName} initializing their own address {Address}", userName,
|
||||
publicAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.LogWarning("User {UserName} attempted to initialize address {Address} that doesn't belong to them", userName, publicAddress);
|
||||
|
||||
_logger.LogWarning("User {UserName} attempted to initialize address {Address} that doesn't belong to them",
|
||||
userName, publicAddress);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Unable to verify ownership of address {Address} for user {UserName}", publicAddress, userName);
|
||||
_logger.LogWarning(ex, "Unable to verify ownership of address {Address} for user {UserName}", publicAddress,
|
||||
userName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -268,11 +272,6 @@ public class TradingController : BaseController
|
||||
return BadRequest("Strategy is required.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.DocumentationUrl))
|
||||
{
|
||||
return BadRequest("Documentation URL is required.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.RequesterName))
|
||||
{
|
||||
return BadRequest("Requester name is required.");
|
||||
@@ -281,7 +280,7 @@ public class TradingController : BaseController
|
||||
try
|
||||
{
|
||||
var webhookUrl = _configuration["N8n:IndicatorRequestWebhookUrl"];
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(webhookUrl))
|
||||
{
|
||||
_logger.LogError("N8n indicator request webhook URL is not configured");
|
||||
@@ -289,26 +288,26 @@ public class TradingController : BaseController
|
||||
}
|
||||
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
|
||||
|
||||
_logger.LogInformation(
|
||||
"Submitting indicator request: {IndicatorName} - {Strategy} by {Requester}",
|
||||
request.IndicatorName,
|
||||
request.StrategyDescription,
|
||||
request.IndicatorName,
|
||||
request.StrategyDescription,
|
||||
request.RequesterName);
|
||||
|
||||
// Send as JSON payload
|
||||
var response = await httpClient.PostAsJsonAsync(webhookUrl, request);
|
||||
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Successfully submitted indicator request: {IndicatorName} by {Requester}",
|
||||
request.IndicatorName,
|
||||
request.IndicatorName,
|
||||
request.RequesterName);
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
Success = true,
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
Success = true,
|
||||
Message = "Indicator request submitted successfully.",
|
||||
IndicatorName = request.IndicatorName,
|
||||
Strategy = request.StrategyDescription,
|
||||
@@ -322,21 +321,21 @@ public class TradingController : BaseController
|
||||
"Failed to submit indicator request. Status: {StatusCode}, Response: {Response}",
|
||||
response.StatusCode,
|
||||
responseContent);
|
||||
|
||||
return StatusCode(500, new
|
||||
{
|
||||
Success = false,
|
||||
Error = $"Failed to submit indicator request. Status: {response.StatusCode}"
|
||||
|
||||
return StatusCode(500, new
|
||||
{
|
||||
Success = false,
|
||||
Error = $"Failed to submit indicator request. Status: {response.StatusCode}"
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error submitting indicator request: {IndicatorName}", request.IndicatorName);
|
||||
return StatusCode(500, new
|
||||
{
|
||||
Success = false,
|
||||
Error = "An error occurred while submitting the indicator request."
|
||||
return StatusCode(500, new
|
||||
{
|
||||
Success = false,
|
||||
Error = "An error occurred while submitting the indicator request."
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user