package admin import ( "context" "errors" "github.com/google/uuid" "github.com/jackc/pgx/v5" "github.com/yuxingu/digital-psychology/apps/api/internal/repository" ) var ErrInterventionOutcomeNotFound = errString("intervention outcome not found") // ListInterventionOutcomes returns catalog. func (s *Service) ListInterventionOutcomes(ctx context.Context) ([]repository.InterventionOutcomeRow, error) { items, err := s.Repo.ListInterventionOutcomes(ctx) if err != nil { return nil, err } if items == nil { items = []repository.InterventionOutcomeRow{} } return items, nil } // GetInterventionOutcome loads one. func (s *Service) GetInterventionOutcome(ctx context.Context, id uuid.UUID) (*repository.InterventionOutcomeRow, error) { row, err := s.Repo.GetInterventionOutcome(ctx, id) if errors.Is(err, pgx.ErrNoRows) { return nil, ErrInterventionOutcomeNotFound } return row, err }