mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 01:45:15 +00:00
Daniel Mason
99f9e7cfb3
- Tidy init/goscrobble.service - Add routers for Artist/Album/Track endpoints + basic pages - Move UUID generation into Go so we don't have to query the record!! Wooo!
22 lines
501 B
Go
22 lines
501 B
Go
package goscrobble
|
|
|
|
type ProfileResponse struct {
|
|
UUID string `json:"uuid"`
|
|
Username string `json:"username"`
|
|
Scrobbles []ScrobbleResponseItem `json:"scrobbles"`
|
|
}
|
|
|
|
func getProfileForUser(user User) (ProfileResponse, error) {
|
|
resp := ProfileResponse{
|
|
UUID: user.UUID,
|
|
Username: user.Username,
|
|
}
|
|
scrobbleReq, err := getScrobblesForUser(user.UUID, 10, 1)
|
|
if err != nil {
|
|
return resp, err
|
|
}
|
|
|
|
resp.Scrobbles = scrobbleReq.Items
|
|
return resp, nil
|
|
}
|