lot of new functionalities
This commit is contained in:
@@ -3,6 +3,7 @@ package services
|
||||
import (
|
||||
"context"
|
||||
|
||||
groupstorage "git.coopgo.io/coopgo-platform/groups-management/storage"
|
||||
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
||||
"google.golang.org/grpc"
|
||||
@@ -134,3 +135,27 @@ func (s *ServicesHandler) GetAccount(id string) (account storage.Account, err er
|
||||
|
||||
return resp.Account.ToStorageType(), nil
|
||||
}
|
||||
|
||||
func (s *ServicesHandler) GetBeneficiariesInGroup(group groupstorage.Group) (accounts []storage.Account, err error) {
|
||||
accounts = []storage.Account{}
|
||||
|
||||
if len(group.Members) == 0 {
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
request := &mobilityaccounts.GetAccountsBatchRequest{
|
||||
Accountids: group.Members,
|
||||
}
|
||||
|
||||
resp, err := s.GRPC.MobilityAccounts.GetAccountsBatch(context.TODO(), request)
|
||||
if err != nil {
|
||||
return accounts, err
|
||||
}
|
||||
|
||||
for _, account := range resp.Accounts {
|
||||
a := account.ToStorageType()
|
||||
accounts = append(accounts, a)
|
||||
}
|
||||
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user