Update code in endpoints/playlist.get.py

This commit is contained in:
Backend IM Bot 2025-03-28 15:09:36 +00:00
parent 50f3404602
commit e86868fdde

View File

@ -1,19 +1,19 @@
# Entity: Song # Entity: Playlist
from fastapi import APIRouter, Depends, HTTPException, status from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from typing import List from typing import List
from core.database import get_db from core.database import get_db
from models.song import Song from models.playlist import Playlist
from schemas.song import SongSchema from schemas.playlist import PlaylistSchema
from helpers.song_helpers import get_all_songs from helpers.playlist_helpers import get_playlist_songs
router = APIRouter() router = APIRouter()
@router.get("/playlist", status_code=200, response_model=List[SongSchema]) @router.get("/playlist", response_model=List[PlaylistSchema], status_code=200)
async def get_playlist( async def get_playlist_songs(
db: Session = Depends(get_db) db: Session = Depends(get_db)
): ):
"""Get all songs from library""" """Get all songs from playlist"""
songs = get_all_songs(db) songs = get_playlist_songs(db)
return songs return songs