28 lines
826 B
Python
28 lines
826 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
from ..db.database import get_db
|
|
from ..schemas.account import AccountStatsResponse, ListeningHistoryItem
|
|
from ..models.song import Song
|
|
from ..models.playlist import Playlist
|
|
|
|
router = APIRouter(prefix="/api/account", tags=["account"])
|
|
|
|
|
|
@router.get("/stats", response_model=AccountStatsResponse)
|
|
def get_account_stats(db: Session = Depends(get_db)):
|
|
total_songs = db.query(Song).count()
|
|
total_playlists = db.query(Playlist).count()
|
|
|
|
return AccountStatsResponse(
|
|
total_songs=total_songs,
|
|
total_playlists=total_playlists,
|
|
total_listening_time=0,
|
|
top_artists=[],
|
|
top_genres=[],
|
|
top_moods=[],
|
|
)
|
|
|
|
|
|
@router.get("/history")
|
|
def get_account_history(db: Session = Depends(get_db)):
|
|
return [] |