add more detail to credits on /api/v1/artist/{id}
This commit is contained in:
parent
1846203076
commit
e2ec731109
|
@ -8,6 +8,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"arimelody-web/admin"
|
||||
"arimelody-web/global"
|
||||
|
@ -38,6 +39,10 @@ func ServeArtist(artist *model.Artist) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
type (
|
||||
creditJSON struct {
|
||||
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"`
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue