Add paginated user retrieval functionality in AdminController and related services. Implemented UsersFilter for filtering user queries and added LastConnectionDate property to User model. Updated database schema and frontend API to support new user management features.

This commit is contained in:
2025-11-17 20:04:17 +07:00
parent 06ef33b7ab
commit 02e46e8d0d
20 changed files with 2559 additions and 6 deletions

View File

@@ -2,11 +2,12 @@
using Managing.Application.Abstractions.Grains;
using Managing.Application.Abstractions.Repositories;
using Managing.Application.Abstractions.Services;
using Managing.Common;
using Managing.Application.Abstractions.Shared;
using Managing.Domain.Accounts;
using Managing.Domain.Users;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using static Managing.Common.Enums;
namespace Managing.Application.Users;
@@ -113,6 +114,10 @@ public class UserService : IUserService
await _userRepository.SaveOrUpdateUserAsync(user);
}
// Update last connection date
user.LastConnectionDate = DateTimeOffset.UtcNow;
await _userRepository.SaveOrUpdateUserAsync(user);
return user;
}
else
@@ -132,8 +137,8 @@ public class UserService : IUserService
{
Name = $"{name}-embedded",
Key = recoveredAddress,
Exchange = Enums.TradingExchanges.Evm,
Type = Enums.AccountType.Privy
Exchange = TradingExchanges.Evm,
Type = AccountType.Privy
});
user.Accounts = new List<Account>()
@@ -158,6 +163,10 @@ public class UserService : IUserService
// Don't throw here to avoid breaking the user creation process
}
}
// Update last connection date for new user
user.LastConnectionDate = DateTimeOffset.UtcNow;
await _userRepository.SaveOrUpdateUserAsync(user);
}
return user;
@@ -313,4 +322,9 @@ public class UserService : IUserService
return user;
}
public async Task<(IEnumerable<User> Users, int TotalCount)> GetUsersPaginatedAsync(int page, int pageSize, UserSortableColumn sortBy, string sortOrder, UsersFilter filter)
{
return await _userRepository.GetUsersPaginatedAsync(page, pageSize, sortBy, sortOrder, filter);
}
}