Enhance user authentication by adding optional OwnerWalletAddress parameter in LoginRequest and UserService. Update UserController and related components to support the new wallet address functionality, ensuring better user profile management and validation in trading operations.
This commit is contained in:
1723
src/Managing.Infrastructure.Database/Migrations/20251117062104_UpdateKudaiStakingValidation.Designer.cs
generated
Normal file
1723
src/Managing.Infrastructure.Database/Migrations/20251117062104_UpdateKudaiStakingValidation.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Managing.Infrastructure.Databases.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateKudaiStakingValidation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OwnerWalletAddress",
|
||||
table: "Users",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerWalletAddress",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1418,6 +1418,9 @@ namespace Managing.Infrastructure.Databases.Migrations
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("OwnerWalletAddress")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TelegramChannel")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
@@ -13,6 +13,7 @@ public class UserEntity
|
||||
[MaxLength(255)] public string? AgentName { get; set; }
|
||||
public string? AvatarUrl { get; set; }
|
||||
public string? TelegramChannel { get; set; }
|
||||
public string? OwnerWalletAddress { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
|
||||
@@ -130,6 +130,7 @@ public static class PostgreSqlMappers
|
||||
AgentName = entity.AgentName,
|
||||
AvatarUrl = entity.AvatarUrl,
|
||||
TelegramChannel = entity.TelegramChannel,
|
||||
OwnerWalletAddress = entity.OwnerWalletAddress,
|
||||
Id = entity.Id, // Assuming Id is the primary key for UserEntity
|
||||
IsAdmin = entity.IsAdmin,
|
||||
Accounts = entity.Accounts?.Select(MapAccountWithoutUser).ToList() ?? new List<Account>()
|
||||
@@ -165,6 +166,7 @@ public static class PostgreSqlMappers
|
||||
AgentName = user.AgentName,
|
||||
AvatarUrl = user.AvatarUrl,
|
||||
TelegramChannel = user.TelegramChannel,
|
||||
OwnerWalletAddress = user.OwnerWalletAddress,
|
||||
IsAdmin = user.IsAdmin
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ public class PostgreSqlUserRepository : BaseRepositoryWithLogging, IUserReposito
|
||||
Name = u.Name,
|
||||
AgentName = u.AgentName,
|
||||
AvatarUrl = u.AvatarUrl,
|
||||
TelegramChannel = u.TelegramChannel
|
||||
TelegramChannel = u.TelegramChannel,
|
||||
OwnerWalletAddress = u.OwnerWalletAddress
|
||||
})
|
||||
.FirstOrDefaultAsync()
|
||||
.ConfigureAwait(false);
|
||||
@@ -93,7 +94,8 @@ public class PostgreSqlUserRepository : BaseRepositoryWithLogging, IUserReposito
|
||||
Name = u.Name,
|
||||
AgentName = u.AgentName,
|
||||
AvatarUrl = u.AvatarUrl,
|
||||
TelegramChannel = u.TelegramChannel
|
||||
TelegramChannel = u.TelegramChannel,
|
||||
OwnerWalletAddress = u.OwnerWalletAddress
|
||||
})
|
||||
.FirstOrDefaultAsync()
|
||||
.ConfigureAwait(false);
|
||||
@@ -208,7 +210,8 @@ public class PostgreSqlUserRepository : BaseRepositoryWithLogging, IUserReposito
|
||||
Name = u.Name,
|
||||
AgentName = u.AgentName,
|
||||
AvatarUrl = u.AvatarUrl,
|
||||
TelegramChannel = u.TelegramChannel
|
||||
TelegramChannel = u.TelegramChannel,
|
||||
OwnerWalletAddress = u.OwnerWalletAddress
|
||||
})
|
||||
.ToListAsync()
|
||||
.ConfigureAwait(false);
|
||||
@@ -249,6 +252,7 @@ public class PostgreSqlUserRepository : BaseRepositoryWithLogging, IUserReposito
|
||||
existingUser.AgentName = user.AgentName;
|
||||
existingUser.AvatarUrl = user.AvatarUrl;
|
||||
existingUser.TelegramChannel = user.TelegramChannel;
|
||||
existingUser.OwnerWalletAddress = user.OwnerWalletAddress;
|
||||
existingUser.IsAdmin = user.IsAdmin;
|
||||
|
||||
_context.Users.Update(existingUser);
|
||||
|
||||
Reference in New Issue
Block a user