Files
Paul NicolasandGitHub 1c854a145c feat(pools): add possibility to create dynamic pool (#598)
* feat(pools): add dynamic pools creation

* fix(pools): fix missing json handling

* feat(openapi): add pool type enum
2025-11-24 12:50:07 +00:00

26 lines
573 B
Go

package services
import (
"context"
"github.com/formancehq/payments/internal/models"
"github.com/google/uuid"
)
func (s *Service) PoolsGet(ctx context.Context, id uuid.UUID) (*models.Pool, error) {
p, err := s.storage.PoolsGet(ctx, id)
if err != nil {
return nil, newStorageError(err, "cannot get pool")
}
if p.Type == models.POOL_TYPE_DYNAMIC {
// populate the pool accounts from the query
p.PoolAccounts, err = s.populatePoolAccounts(ctx, p)
if err != nil {
return nil, newStorageError(err, "cannot populate pool accounts")
}
}
return p, nil
}