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"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"arimelody-web/admin"
|
"arimelody-web/admin"
|
||||||
"arimelody-web/global"
|
"arimelody-web/global"
|
||||||
|
@ -38,6 +39,10 @@ func ServeArtist(artist *model.Artist) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
type (
|
type (
|
||||||
creditJSON struct {
|
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"`
|
Role string `json:"role"`
|
||||||
Primary bool `json:"primary"`
|
Primary bool `json:"primary"`
|
||||||
}
|
}
|
||||||
|
@ -60,6 +65,10 @@ func ServeArtist(artist *model.Artist) http.Handler {
|
||||||
var credits = map[string]creditJSON{}
|
var credits = map[string]creditJSON{}
|
||||||
for _, credit := range dbCredits {
|
for _, credit := range dbCredits {
|
||||||
credits[credit.Release.ID] = creditJSON{
|
credits[credit.Release.ID] = creditJSON{
|
||||||
|
ID: credit.Release.ID,
|
||||||
|
Title: credit.Release.Title,
|
||||||
|
ReleaseDate: credit.Release.ReleaseDate,
|
||||||
|
Artwork: credit.Release.Artwork,
|
||||||
Role: credit.Role,
|
Role: credit.Role,
|
||||||
Primary: credit.Primary,
|
Primary: credit.Primary,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue