HEAVY: finish music service migration, tidy up services, more tests

This commit is contained in:
ari melody 2026-08-01 00:29:31 +01:00
parent 9e311df462
commit 90a671982c
Signed by: ari
GPG key ID: CF99829C92678188
47 changed files with 2698 additions and 902 deletions

View file

@ -6,7 +6,6 @@ import (
"strings"
"arimelody-web/admin/templates"
"arimelody-web/controller"
"arimelody-web/model"
"arimelody-web/model/app"
)
@ -23,7 +22,7 @@ func serveArtists(app *app.AppState) http.Handler {
return
}
artists, err := controller.GetAllArtists(app.DB)
artists, err := app.MusicService.GetAllArtists()
if err != nil {
fmt.Printf("WARN: Failed to fetch artists: %s\n", err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
@ -50,7 +49,7 @@ func serveArtist(app *app.AppState, artistID string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
session := r.Context().Value("session").(*model.Session)
artist, err := controller.GetArtist(app.DB, artistID)
artist, err := app.MusicService.GetArtistByID(artistID)
if err != nil {
if artist == nil {
http.NotFound(w, r)
@ -61,7 +60,7 @@ func serveArtist(app *app.AppState, artistID string) http.Handler {
return
}
credits, err := controller.GetArtistCredits(app.DB, artist.ID, true)
credits, err := app.MusicService.GetArtistCredits(artistID, true)
if err != nil {
fmt.Printf("WARN: Failed to serve admin artist page for %s: %s\n", artistID, err)
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)