Add user settings update functionality in UserController and UserService

Implement a new endpoint in UserController to allow users to update their settings. The UserService is updated to handle the logic for updating user settings, including partial updates for various fields. Additionally, the User entity and database schema are modified to accommodate new user settings properties, ensuring persistence and retrieval of user preferences.
This commit is contained in:
2025-12-30 05:54:15 +07:00
parent 95e60108af
commit 79d8a381d9
13 changed files with 2022 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Managing.Common;
using Microsoft.EntityFrameworkCore;
using static Managing.Common.Enums;
namespace Managing.Infrastructure.Databases.PostgreSql.Entities;
@@ -17,6 +19,15 @@ public class UserEntity
public DateTimeOffset? LastConnectionDate { get; set; }
public bool IsAdmin { get; set; }
// User Settings
[Column(TypeName = "decimal(18,8)")] public decimal? LowEthAmountAlert { get; set; }
public bool EnableAutoswap { get; set; } = false;
[Column(TypeName = "decimal(18,8)")] public decimal? AutoswapAmount { get; set; }
public int? MaxWaitingTimeForPositionToGetFilledSeconds { get; set; }
[Column(TypeName = "decimal(18,8)")] public decimal? MaxTxnGasFeePerPosition { get; set; }
public bool IsGmxEnabled { get; set; } = false;
public Confidence? MinimumConfidence { get; set; }
// Navigation properties
public virtual ICollection<AccountEntity> Accounts { get; set; } = new List<AccountEntity>();
}