adjusted frontend event handling to optimize json payload size for different events, fixed incorrect behavior when currently playing track is removed from queue

This commit is contained in:
2026-02-18 00:49:29 -05:00
parent be6f4e9764
commit 026ab1c333
14 changed files with 2221 additions and 574 deletions
+40
View File
@@ -299,6 +299,46 @@ func (s *Service) CreatePlaylistWithTracks(
return summary, nil
}
// RemoveTracksFromPlaylist removes multiple tracks from a playlist by their
// playlist_track IDs. Each track is removed individually using the existing
// RemovePlaylistTrack query.
func (s *Service) RemoveTracksFromPlaylist(
playlistID int64,
trackIDs []int64,
) error {
if len(trackIDs) == 0 {
return nil
}
for _, id := range trackIDs {
if err := s.db.Queries.RemovePlaylistTrack(
s.db.Ctx,
id,
); err != nil {
s.logger.Error(
"Failed to remove playlist track",
"playlistId", playlistID,
"trackId", id,
"err", err,
)
return fmt.Errorf(
"failed to remove track %d from playlist: %w",
id,
err,
)
}
}
s.logger.Info(
"Tracks removed from playlist",
"playlistId", playlistID,
"count", len(trackIDs),
)
return nil
}
// addSingleTrack looks up the audio file by path and inserts it into the playlist.
func (s *Service) addSingleTrack(
playlistID int64,