Add song listing endpoints

This commit is contained in:
Esa Kataja
2025-05-04 21:04:45 +03:00
parent b878fc6b5b
commit 3e35e5de41
15 changed files with 1522 additions and 31 deletions
+63
View File
@@ -0,0 +1,63 @@
from pydantic import BaseModel, Field
from datetime import datetime, timezone
class Song(BaseModel):
id: int | None = Field(
default=None, description="Database ID of the song.", example=1
)
year: int = Field(description="Year of the Eurovision contest.", example=2023)
country_fi: str = Field(description="Country of the song.", example="Suomi")
country_en: str = Field(description="Country of the song.", example="Finland")
country_code: str = Field(description="Country code of the song.", example="FIN")
artist: str = Field(description="Artist of the song.", example="Käärijä")
title: str = Field(description="Title of the song.", example="Cha Cha Cha")
running_order: int | None = Field(
default=None, description="Running order of the song.", example=13
)
lyrics_url: str | None = Field(
default=None,
description="URL to the original lyrics.",
example="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
)
artist_url: str | None = Field(
default=None,
description="URL to the artist's page.",
example="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
)
flag_url: str | None = Field(
default=None,
description="URL to the country flag.",
example="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
)
lyrics_original: str | None = Field(
default=None,
description="Original lyrics.",
example="Lyrics",
)
lyrics_translation_fi: str | None = Field(
default=None,
description="Finnish translation of the lyrics.",
example="Lyrics",
)
tags: list[str] | None = Field(
default=None,
description="Tags associated with the song.",
example=["Eskapismi", "Muutos", "Hedonismi", "Kaksijakoisuus", "Alkoholi"],
)
confidence: float | None = Field(
default=None, description="Confidence level of the translation.", example=0.95
)
language: str | None = Field(
default=None, description="Language of the song.", example="Suomi"
)
created_at: datetime = Field(
default=datetime.now(timezone.utc),
description="Time when the song was created. UTC timezone.",
example="2025-05-04T19:40:12.123456",
)
updated_at: datetime = Field(
default=datetime.now(timezone.utc),
description="Time when the song was last updated. UTC timezone.",
example="2025-05-04T19:40:12.123456",
)