feat(subsonic): wire contextual_likes capture/soft-delete into star/unstar

handleStar's track branch calls playevents.CaptureContextualLikeIfPlaying
when the underlying LikeTrack actually inserted a row. handleUnstar
calls SoftDeleteContextualLikes after every track-id unstar. Same
helpers as the api surface — single source of truth.

mediaHandlers struct gains a logger field threaded through Mount.
This commit is contained in:
2026-04-27 11:25:10 -04:00
parent fe1cc46752
commit bf7c5ad47d
5 changed files with 60 additions and 7 deletions
+1 -2
View File
@@ -21,7 +21,7 @@ import (
// either way.
func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, cfg Config, events *playevents.Writer) {
b := &browseHandlers{pool: pool}
m := newMediaHandlers(pool, events)
m := newMediaHandlers(pool, events, logger)
r.Route("/rest", func(sub chi.Router) {
sub.Use(Middleware(pool, cfg))
register(sub, "/ping", handlePing)
@@ -52,7 +52,6 @@ func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, cfg Config, ev
sub.NotFound(func(w http.ResponseWriter, r *http.Request) {
WriteFail(w, r, ErrGeneric, "Method not implemented")
})
_ = logger
})
}