lot of new functionalities

This commit is contained in:
Arnaud Delcasse
2025-10-14 18:11:13 +02:00
parent a6f70a6e85
commit d992a7984f
164 changed files with 15113 additions and 9442 deletions

View File

@@ -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
}