refactor: Rename global current playlist methods for clarity and consistency

This commit is contained in:
JSC
2025-08-01 17:12:56 +02:00
parent c0f51b2e23
commit 0575d12b0e
6 changed files with 33 additions and 104 deletions

View File

@@ -53,20 +53,7 @@ class PlaylistRepository(BaseRepository[Playlist]):
logger.exception("Failed to get main playlist")
raise
async def get_current_playlist(self, user_id: int) -> Playlist | None:
"""Get the user's current playlist."""
try:
statement = select(Playlist).where(
Playlist.user_id == user_id,
Playlist.is_current == True, # noqa: E712
)
result = await self.session.exec(statement)
return result.first()
except Exception:
logger.exception("Failed to get current playlist for user: %s", user_id)
raise
async def get_global_current_playlist(self) -> Playlist | None:
async def get_current_playlist(self) -> Playlist | None:
"""Get the global current playlist (app-wide)."""
try:
statement = select(Playlist).where(
@@ -75,7 +62,7 @@ class PlaylistRepository(BaseRepository[Playlist]):
result = await self.session.exec(statement)
return result.first()
except Exception:
logger.exception("Failed to get global current playlist")
logger.exception("Failed to get current playlist")
raise
async def search_by_name(