Select the types of activity you want to include in your feed.
Add the same query functionality that was possible for artists to
recordings. So searching on recordings and their scrobble count based on
mbids, user id and datetime range.
···66 "github.com/oscar345/keeptrack/pkg/pagination"
77)
8899-type Count struct {
99+type ArtistCount struct {
1010 Pagination pagination.Filter
1111 From time.Time
1212 To time.Time
1313 UserID int
1414}
1515+1616+type RecordingCount struct {
1717+ Pagination pagination.Filter
1818+ From time.Time
1919+ To time.Time
2020+ ArtistMBID string
2121+ UserID int
2222+}
+10-2
internal/models/catalog.go
···77 ImageURL string
88}
991010+type ArtistCreditName struct {
1111+ Artist Artist
1212+ Name string
1313+ JoinPhrase string
1414+ Position int
1515+}
1616+1017type Recording struct {
1111- MBID string
1212- Name string
1818+ MBID string
1919+ Name string
2020+ Artists []ArtistCreditName
1321}
14221523type Release struct {
+2
internal/models/scrobble.go
···11package models
2233+// A generic struct that holds both the count and the mbid associated with that count. The mbid does
44+// not have to be for a specific entity, and can be used for recordings, releases and artists, etc...
35type CountMBID struct {
46 Count int
57 MBID string
···11+package db
22+33+import "github.com/oscar345/keeptrack/internal/models"
44+55+// for some queries internal models for this packages are needed that should not be used outside of
66+// this package, and models outside of this package should not be altered to be able to be used
77+// inside this package
88+99+type artist struct {
1010+ MBID string `json:"mbid"`
1111+ Name string `json:"name"`
1212+}
1313+1414+func (a *artist) toModel() models.Artist {
1515+ return models.Artist{
1616+ MBID: a.MBID,
1717+ Name: a.Name,
1818+ }
1919+}
2020+2121+type artistCreditName struct {
2222+ Artist artist `json:"artist"`
2323+ Name string `json:"name"`
2424+ JoinPhrase string `json:"join_phrase"`
2525+ Position int `json:"position"`
2626+}
2727+2828+func (a *artistCreditName) toModel() models.ArtistCreditName {
2929+ return models.ArtistCreditName{
3030+ Artist: a.Artist.toModel(),
3131+ Name: a.Name,
3232+ JoinPhrase: a.JoinPhrase,
3333+ Position: a.Position,
3434+ }
3535+}
···3737 }
3838}
39394040-func (as *ArtistService) ListArtistByCount(ctx context.Context, filter filters.Count) ([]models.Artist, pagination.Page, error) {
4040+func (as *ArtistService) ListArtistByCount(ctx context.Context, filter filters.ArtistCount) ([]models.Artist, pagination.Page, error) {
4141 // Since this should return a general list, we do not want to filter on user. The user service
4242 // should be used to get the user specific list.
4343 filter.UserID = 0