拆分商品模块服务和处理器职责
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package listing
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *Service) ListPublic(ctx context.Context, query PublicListQuery) (*PublicListResult, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.ListPublic(ctx, query)
|
||||
}
|
||||
|
||||
func (s *Service) ListMine(ctx context.Context, ownerID uint64) ([]ListingDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.ListMine(ctx, ownerID)
|
||||
}
|
||||
|
||||
func (s *Service) FindPublic(ctx context.Context, id uint64) (*ListingDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.FindPublic(ctx, id)
|
||||
}
|
||||
|
||||
func (s *Service) FindPublicCoverKey(ctx context.Context, id uint64) (string, error) {
|
||||
if s.repo == nil {
|
||||
return "", ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.FindPublicCoverKey(ctx, id)
|
||||
}
|
||||
|
||||
func (s *Service) FindPublicScreenshotKey(ctx context.Context, id uint64, index int) (string, error) {
|
||||
if s.repo == nil {
|
||||
return "", ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.FindPublicScreenshotKey(ctx, id, index)
|
||||
}
|
||||
|
||||
func (s *Service) FindMine(ctx context.Context, ownerID uint64, id uint64) (*ListingDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.FindMine(ctx, ownerID, id)
|
||||
}
|
||||
Reference in New Issue
Block a user