🐛 Fix stuff I think
This commit is contained in:
21
DysonNetwork.Shared/Registry/AccountClientHelper.cs
Normal file
21
DysonNetwork.Shared/Registry/AccountClientHelper.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using DysonNetwork.Shared.Proto;
|
||||
|
||||
namespace DysonNetwork.Shared.Registry;
|
||||
|
||||
public class AccountClientHelper(AccountService.AccountServiceClient accounts)
|
||||
{
|
||||
public async Task<Account> GetAccount(Guid id)
|
||||
{
|
||||
var request = new GetAccountRequest { Id = id.ToString() };
|
||||
var response = await accounts.GetAccountAsync(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
public async Task<List<Account>> GetAccountBatch(List<Guid> ids)
|
||||
{
|
||||
var request = new GetAccountBatchRequest();
|
||||
request.Id.AddRange(ids.Select(id => id.ToString()));
|
||||
var response = await accounts.GetAccountBatchAsync(request);
|
||||
return response.Accounts.ToList();
|
||||
}
|
||||
}
|
@@ -40,7 +40,8 @@ public static class ServiceHelper
|
||||
.CreateAccountServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
});
|
||||
});
|
||||
services.AddSingleton<AccountClientHelper>();
|
||||
|
||||
services.AddSingleton<ActionLogService.ActionLogServiceClient>(sp =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user