implemented getStarred (just for albums, for now)
This commit is contained in:
@@ -26,6 +26,8 @@ type Entry struct {
|
||||
ContentType string
|
||||
}
|
||||
|
||||
type Entries []Entry
|
||||
|
||||
var (
|
||||
ErrDataNotFound = errors.New("Data Not Found")
|
||||
)
|
||||
|
||||
@@ -14,6 +14,7 @@ type ListGenerator interface {
|
||||
GetFrequent(offset int, size int) (*domain.Albums, error)
|
||||
GetHighest(offset int, size int) (*domain.Albums, error)
|
||||
GetRandom(offset int, size int) (*domain.Albums, error)
|
||||
GetStarred() (*Entries, error)
|
||||
}
|
||||
|
||||
func NewListGenerator(alr domain.AlbumRepository) ListGenerator {
|
||||
@@ -69,3 +70,17 @@ func (g listGenerator) GetRandom(offset int, size int) (*domain.Albums, error) {
|
||||
}
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
func (g listGenerator) GetStarred() (*Entries, error) {
|
||||
albums, err := g.albumRepo.GetStarred(domain.QueryOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
entries := make(Entries, len(*albums))
|
||||
|
||||
for i, al := range *albums {
|
||||
entries[i] = FromAlbum(&al)
|
||||
}
|
||||
|
||||
return &entries, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user