mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat(pools): add dynamic pools creation * fix(pools): fix missing json handling * feat(openapi): add pool type enum
26 lines
573 B
Go
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
|
|
}
|