feat(ECR-039): GrowthInsights FunnelDefinition 只读并 Closed

FunnelDefinition catalog (000040) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:17:12 +08:00
parent 63742c1d66
commit e955f1e6a2
25 changed files with 455 additions and 1 deletions
@@ -0,0 +1,34 @@
package admin
import (
"context"
"errors"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/yuxingu/digital-psychology/apps/api/internal/repository"
)
var ErrFunnelDefinitionNotFound = errString("funnel definition not found")
// ListFunnelDefinitions returns catalog.
func (s *Service) ListFunnelDefinitions(ctx context.Context) ([]repository.FunnelDefinitionRow, error) {
items, err := s.Repo.ListFunnelDefinitions(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.FunnelDefinitionRow{}
}
return items, nil
}
// GetFunnelDefinition loads one.
func (s *Service) GetFunnelDefinition(ctx context.Context, id uuid.UUID) (*repository.FunnelDefinitionRow, error) {
row, err := s.Repo.GetFunnelDefinition(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrFunnelDefinitionNotFound
}
return row, err
}