From e2ec7311091b7d540217085b4720626e13b9e47e Mon Sep 17 00:00:00 2001 From: ari melody Date: Sun, 20 Oct 2024 20:05:30 +0100 Subject: [PATCH] add more detail to credits on /api/v1/artist/{id} --- api/artist.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/artist.go b/api/artist.go index 00f185d..90bd18a 100644 --- a/api/artist.go +++ b/api/artist.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" "strings" + "time" "arimelody-web/admin" "arimelody-web/global" @@ -38,8 +39,12 @@ func ServeArtist(artist *model.Artist) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { type ( creditJSON struct { - Role string `json:"role"` - Primary bool `json:"primary"` + ID string `json:"id"` + Title string `json:"title"` + ReleaseDate time.Time `json:"releaseDate" db:"release_date"` + Artwork string `json:"artwork"` + Role string `json:"role"` + Primary bool `json:"primary"` } artistJSON struct { *model.Artist @@ -60,6 +65,10 @@ func ServeArtist(artist *model.Artist) http.Handler { var credits = map[string]creditJSON{} for _, credit := range dbCredits { credits[credit.Release.ID] = creditJSON{ + ID: credit.Release.ID, + Title: credit.Release.Title, + ReleaseDate: credit.Release.ReleaseDate, + Artwork: credit.Release.Artwork, Role: credit.Role, Primary: credit.Primary, }