This commit is contained in:
imperosol
2026-02-14 15:58:07 +01:00
parent 2796f9b213
commit 2922725fe4
3 changed files with 14 additions and 28 deletions

View File

@@ -26,19 +26,10 @@ class SimpleAlbumSchema(ModelSchema):
class AlbumSchema(ModelSchema):
class Meta:
model = Album
fields = ["id", "name", "is_moderated"]
fields = ["id", "name", "is_moderated", "thumbnail"]
thumbnail: str | None
sas_url: str
@staticmethod
def resolve_thumbnail(obj: Album) -> str | None:
# Album thumbnails aren't stored in `Album.thumbnail` but in `Album.file`
# Don't ask me why.
if not obj.file:
return None
return obj.get_download_url()
@staticmethod
def resolve_sas_url(obj: Album) -> str:
return obj.get_absolute_url()