Skip to content

Commit

Permalink
adicionando capa do album a rota de buscar album pelo id do artista
Browse files Browse the repository at this point in the history
  • Loading branch information
Divaldoh committed Jul 19, 2024
1 parent abc4a8d commit 3237815
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/api/endpoints/handlers/user_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (h UserHandlers) GetAlbumsArtist(context echo.Context) error {
each.ArtistID(),
each.ReleaseDate(),
each.Description(),
nil,
each.ImageURL(),
)
albums = append(albums, *albumBuilder)

Expand Down
4 changes: 2 additions & 2 deletions src/core/domain/album/album.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func (a Album) Description() *string {
return a.description
}

func (a Album) ImageURL() string {
return a.imageURL
func (a Album) ImageURL() *string {
return &a.imageURL
}
6 changes: 5 additions & 1 deletion src/infra/spotify/user_spotify_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ func (u UserSpotifyRepository) FindArtistAlbumsByID(artistID string) ([]album.Al
return nil, errors.NewUnexpectedError(messages.UnexpectedErrorMessage, err)
}

var albumImage *string

albumImage = &single_album.Images[0].URL

albumBuilder := album.NewBuilder()
albumBuilder.WithArtistID(artistID).WithID(albumID.String()).WithName(albumName).WithReleaseDate(albumRealeaseDate)
albumBuilder.WithArtistID(artistID).WithID(albumID.String()).WithName(albumName).WithReleaseDate(albumRealeaseDate).WithImageURL(*albumImage)
albumBuilded, createdError := albumBuilder.Build()
if createdError != nil {
return nil, errors.NewUnexpectedError(messages.UnexpectedErrorMessage, createdError)
Expand Down

0 comments on commit 3237815

Please sign in to comment.