feat(ECR-025): OpsCMS FeedSlot 只读并 Closed
栏目位目录(ops_feed_slots + /cms),复用 admin.cms.read。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
var ErrBannerNotFound = errString("banner not found")
|
||||
var ErrFeedSlotNotFound = errString("feed slot not found")
|
||||
|
||||
// ListBanners returns OpsCMS Banner catalog.
|
||||
func (s *Service) ListBanners(ctx context.Context) ([]repository.BannerRow, error) {
|
||||
@@ -32,3 +33,24 @@ func (s *Service) GetBanner(ctx context.Context, id uuid.UUID) (*repository.Bann
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
|
||||
// ListFeedSlots returns OpsCMS FeedSlot catalog.
|
||||
func (s *Service) ListFeedSlots(ctx context.Context) ([]repository.FeedSlotRow, error) {
|
||||
items, err := s.Repo.ListFeedSlots(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if items == nil {
|
||||
items = []repository.FeedSlotRow{}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// GetFeedSlot loads one feed slot.
|
||||
func (s *Service) GetFeedSlot(ctx context.Context, id uuid.UUID) (*repository.FeedSlotRow, error) {
|
||||
row, err := s.Repo.GetFeedSlot(ctx, id)
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil, ErrFeedSlotNotFound
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user