Refactor user settings management to remove IsGmxEnabled and DefaultExchange from updatable fields, introducing GmxSlippage instead. Update UserController, UserService, and related DTOs to reflect these changes, ensuring proper handling of user settings. Adjust database schema and migrations to accommodate the new GmxSlippage property, enhancing user customization options for trading configurations.
This commit is contained in:
1788
src/Managing.Infrastructure.Database/Migrations/20251230000830_AddGmxSlippageSetting.Designer.cs
generated
Normal file
1788
src/Managing.Infrastructure.Database/Migrations/20251230000830_AddGmxSlippageSetting.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Managing.Infrastructure.Databases.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddGmxSlippageSetting : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// Add column with default value
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "GmxSlippage",
|
||||
table: "Users",
|
||||
type: "numeric(5,2)",
|
||||
nullable: true,
|
||||
defaultValue: 0.5m);
|
||||
|
||||
// Update existing NULL values to default
|
||||
migrationBuilder.Sql(@"
|
||||
UPDATE ""Users""
|
||||
SET ""GmxSlippage"" = 0.5
|
||||
WHERE ""GmxSlippage"" IS NULL;
|
||||
");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GmxSlippage",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1441,6 +1441,9 @@ namespace Managing.Infrastructure.Databases.Migrations
|
||||
b.Property<bool>("EnableAutoswap")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<decimal?>("GmxSlippage")
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ public class UserEntity
|
||||
public int? MaxWaitingTimeForPositionToGetFilledSeconds { get; set; } = 600; // Default: 10 minutes (600 seconds)
|
||||
[Column(TypeName = "decimal(18,8)")] public decimal? MaxTxnGasFeePerPosition { get; set; } = 1.5m; // Default: MaximumGasFeeUsd
|
||||
public bool IsGmxEnabled { get; set; } = false;
|
||||
[Column(TypeName = "decimal(5,2)")] public decimal? GmxSlippage { get; set; } = 0.5m; // Default: 0.5% slippage for GMX trades
|
||||
|
||||
// User Settings - Indicator Combo Configuration
|
||||
public Confidence? MinimumConfidence { get; set; } = Confidence.Medium; // Default: Medium confidence for context indicators
|
||||
|
||||
@@ -140,6 +140,7 @@ public static class PostgreSqlMappers
|
||||
MaxWaitingTimeForPositionToGetFilledSeconds = entity.MaxWaitingTimeForPositionToGetFilledSeconds,
|
||||
MaxTxnGasFeePerPosition = entity.MaxTxnGasFeePerPosition,
|
||||
IsGmxEnabled = entity.IsGmxEnabled,
|
||||
GmxSlippage = entity.GmxSlippage,
|
||||
MinimumConfidence = entity.MinimumConfidence,
|
||||
TrendStrongAgreementThreshold = entity.TrendStrongAgreementThreshold,
|
||||
SignalAgreementThreshold = entity.SignalAgreementThreshold,
|
||||
@@ -187,6 +188,7 @@ public static class PostgreSqlMappers
|
||||
MaxWaitingTimeForPositionToGetFilledSeconds = user.MaxWaitingTimeForPositionToGetFilledSeconds,
|
||||
MaxTxnGasFeePerPosition = user.MaxTxnGasFeePerPosition,
|
||||
IsGmxEnabled = user.IsGmxEnabled,
|
||||
GmxSlippage = user.GmxSlippage,
|
||||
MinimumConfidence = user.MinimumConfidence,
|
||||
TrendStrongAgreementThreshold = user.TrendStrongAgreementThreshold,
|
||||
SignalAgreementThreshold = user.SignalAgreementThreshold,
|
||||
|
||||
@@ -263,6 +263,7 @@ public class PostgreSqlUserRepository : BaseRepositoryWithLogging, IUserReposito
|
||||
existingUser.MaxWaitingTimeForPositionToGetFilledSeconds = user.MaxWaitingTimeForPositionToGetFilledSeconds;
|
||||
existingUser.MaxTxnGasFeePerPosition = user.MaxTxnGasFeePerPosition;
|
||||
existingUser.IsGmxEnabled = user.IsGmxEnabled;
|
||||
existingUser.GmxSlippage = user.GmxSlippage;
|
||||
existingUser.MinimumConfidence = user.MinimumConfidence;
|
||||
existingUser.TrendStrongAgreementThreshold = user.TrendStrongAgreementThreshold;
|
||||
existingUser.SignalAgreementThreshold = user.SignalAgreementThreshold;
|
||||
|
||||
Reference in New Issue
Block a user