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