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

@@ -133,6 +133,14 @@ public static class PostgreSqlMappers
OwnerWalletAddress = entity.OwnerWalletAddress,
Id = entity.Id, // Assuming Id is the primary key for UserEntity
IsAdmin = entity.IsAdmin,
LastConnectionDate = entity.LastConnectionDate,
LowEthAmountAlert = entity.LowEthAmountAlert,
EnableAutoswap = entity.EnableAutoswap,
AutoswapAmount = entity.AutoswapAmount,
MaxWaitingTimeForPositionToGetFilledSeconds = entity.MaxWaitingTimeForPositionToGetFilledSeconds,
MaxTxnGasFeePerPosition = entity.MaxTxnGasFeePerPosition,
IsGmxEnabled = entity.IsGmxEnabled,
MinimumConfidence = entity.MinimumConfidence,
Accounts = entity.Accounts?.Select(MapAccountWithoutUser).ToList() ?? new List<Account>()
};
}
@@ -167,7 +175,15 @@ public static class PostgreSqlMappers
AvatarUrl = user.AvatarUrl,
TelegramChannel = user.TelegramChannel,
OwnerWalletAddress = user.OwnerWalletAddress,
IsAdmin = user.IsAdmin
IsAdmin = user.IsAdmin,
LastConnectionDate = user.LastConnectionDate,
LowEthAmountAlert = user.LowEthAmountAlert,
EnableAutoswap = user.EnableAutoswap,
AutoswapAmount = user.AutoswapAmount,
MaxWaitingTimeForPositionToGetFilledSeconds = user.MaxWaitingTimeForPositionToGetFilledSeconds,
MaxTxnGasFeePerPosition = user.MaxTxnGasFeePerPosition,
IsGmxEnabled = user.IsGmxEnabled,
MinimumConfidence = user.MinimumConfidence
};
}