feat(ECR-036): ExploreConfig RhythmConfig 只读并 Closed

RhythmConfig catalog (000037) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:16:26 +08:00
parent 57acfa6105
commit bd9e13497f
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 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
}