Add whitelisting service + update the jwt valid audience

This commit is contained in:
2025-11-07 19:38:33 +07:00
parent 5578d272fa
commit 21110cd771
17 changed files with 2575 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ using Managing.Domain.Statistics;
using Managing.Domain.Strategies;
using Managing.Domain.Trades;
using Managing.Domain.Users;
using Managing.Domain.Whitelist;
using Managing.Domain.Workers;
using Managing.Infrastructure.Databases.PostgreSql.Entities;
using Newtonsoft.Json;
@@ -992,6 +993,51 @@ public static class PostgreSqlMappers
#endregion
#region WhitelistAccount Mappings
public static WhitelistAccount Map(WhitelistAccountEntity entity)
{
if (entity == null) return null;
return new WhitelistAccount
{
Id = entity.Id,
PrivyId = entity.PrivyId,
PrivyCreationDate = entity.PrivyCreationDate,
EmbeddedWallet = entity.EmbeddedWallet,
ExternalEthereumAccount = entity.ExternalEthereumAccount,
TwitterAccount = entity.TwitterAccount,
IsWhitelisted = entity.IsWhitelisted,
CreatedAt = entity.CreatedAt,
UpdatedAt = entity.UpdatedAt
};
}
public static WhitelistAccountEntity Map(WhitelistAccount whitelistAccount)
{
if (whitelistAccount == null) return null;
return new WhitelistAccountEntity
{
Id = whitelistAccount.Id,
PrivyId = whitelistAccount.PrivyId,
PrivyCreationDate = whitelistAccount.PrivyCreationDate,
EmbeddedWallet = whitelistAccount.EmbeddedWallet,
ExternalEthereumAccount = whitelistAccount.ExternalEthereumAccount,
TwitterAccount = whitelistAccount.TwitterAccount,
IsWhitelisted = whitelistAccount.IsWhitelisted,
CreatedAt = whitelistAccount.CreatedAt,
UpdatedAt = whitelistAccount.UpdatedAt
};
}
public static IEnumerable<WhitelistAccount> Map(IEnumerable<WhitelistAccountEntity> entities)
{
return entities?.Select(Map) ?? Enumerable.Empty<WhitelistAccount>();
}
#endregion
private static int? ExtractBundleIndex(string name)
{
if (string.IsNullOrWhiteSpace(name)) return null;