Nova pàgina de llistes
This commit is contained in:
@@ -216,3 +216,20 @@ async def add_playlist_score_to_playlist(playlist: playlists.Playlist) -> playli
|
||||
)
|
||||
else:
|
||||
return playlist
|
||||
|
||||
|
||||
def get_all_playlists(logged_in: bool = False) -> list[playlists.Playlist]:
|
||||
return list(query.get_all_playlists(logged_in=logged_in))
|
||||
|
||||
|
||||
def set_visibility(playlist_id: int, hidden: bool) -> playlists.Playlist:
|
||||
with get_connection() as con:
|
||||
playlist = get_playlist(playlist_id=playlist_id, con=con)
|
||||
if playlist is None:
|
||||
raise ValueError(f"No playlist found with playlist_id = {playlist_id}!")
|
||||
|
||||
# Update hidden status in database
|
||||
write.update_playlist_visibility(playlist_id=playlist_id, hidden=hidden, con=con)
|
||||
|
||||
# Return updated playlist
|
||||
return dataclasses.replace(playlist, hidden=hidden)
|
||||
|
||||
Reference in New Issue
Block a user