refactor: Update playlist service and endpoints for global current playlist management
This commit is contained in:
@@ -66,6 +66,18 @@ class PlaylistRepository(BaseRepository[Playlist]):
|
||||
logger.exception("Failed to get current playlist for user: %s", user_id)
|
||||
raise
|
||||
|
||||
async def get_global_current_playlist(self) -> Playlist | None:
|
||||
"""Get the global current playlist (app-wide)."""
|
||||
try:
|
||||
statement = select(Playlist).where(
|
||||
Playlist.is_current == True, # noqa: E712
|
||||
)
|
||||
result = await self.session.exec(statement)
|
||||
return result.first()
|
||||
except Exception:
|
||||
logger.exception("Failed to get global current playlist")
|
||||
raise
|
||||
|
||||
async def search_by_name(
|
||||
self, query: str, user_id: int | None = None,
|
||||
) -> list[Playlist]:
|
||||
|
||||
Reference in New Issue
Block a user