Update playlist API endpoints to load library items from DB

This commit is contained in:
advplyr 2023-08-13 11:22:38 -05:00
parent 6056c14926
commit fc44c801f2
5 changed files with 358 additions and 205 deletions

View file

@ -122,9 +122,13 @@ class UserController {
// Todo: check if user is logged in and cancel streams
// Remove user playlists
const userPlaylists = await Database.models.playlist.getPlaylistsForUserAndLibrary(user.id)
const userPlaylists = await Database.models.playlist.findAll({
where: {
userId: user.id
}
})
for (const playlist of userPlaylists) {
await Database.removePlaylist(playlist.id)
await playlist.destroy()
}
const userJson = user.toJSONForBrowser()