add artists list to /api/v1/music
This commit is contained in:
parent
bc1b6c5872
commit
e69cf78e57
3 changed files with 18 additions and 11 deletions
|
@ -27,6 +27,7 @@ func ServeCatalog() http.Handler {
|
|||
type Release struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Artists []string `json:"artists"`
|
||||
ReleaseType model.ReleaseType `json:"type" db:"type"`
|
||||
ReleaseDate time.Time `json:"releaseDate" db:"release_date"`
|
||||
Artwork string `json:"artwork"`
|
||||
|
@ -40,9 +41,15 @@ func ServeCatalog() http.Handler {
|
|||
if !release.Visible && !authorised {
|
||||
continue
|
||||
}
|
||||
artists := []string{}
|
||||
for _, credit := range release.Credits {
|
||||
if !credit.Primary { continue }
|
||||
artists = append(artists, credit.Artist.Name)
|
||||
}
|
||||
catalog = append(catalog, Release{
|
||||
ID: release.ID,
|
||||
Title: release.Title,
|
||||
Artists: artists,
|
||||
ReleaseType: release.ReleaseType,
|
||||
ReleaseDate: release.ReleaseDate,
|
||||
Artwork: release.Artwork,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue