add recent items to the get_all_favorites api route

This commit is contained in:
geoffrey45
2023-04-30 15:38:38 +03:00
parent 3ddb6295c6
commit 5d0b59ea60
4 changed files with 71 additions and 6 deletions
View File
+38
View File
@@ -0,0 +1,38 @@
from app.models import Track, Album, Artist
def recent_fav_track_serializer(track: Track) -> dict:
"""
Simplifies a track object into a dictionary to remove unused
properties on the client.
"""
return {
"image": track.image,
"title": track.title,
"trackhash": track.trackhash,
"filepath": track.filepath,
}
def recent_fav_album_serializer(album: Album) -> dict:
"""
Simplifies an album object into a dictionary to remove unused
properties on the client.
"""
return {
"image": album.image,
"title": album.title,
"albumhash": album.albumhash,
}
def recent_fav_artist_serializer(artist: Artist) -> dict:
"""
Simplifies an artist object into a dictionary to remove unused
properties on the client.
"""
return {
"image": artist.image,
"name": artist.name,
"artisthash": artist.artisthash,
}