- Remove committed .coverage and test-results/ (196K screenshots); gitignore them - Fix hardcoded /home/userpath + venv/bin/python in test_endpoints.py (relative backend dir + sys.executable) - Fix concatenated 'import json' in settings.py; bare excepts -> Exception; SQLAlchemy-safe is_active.is_(True); __all__ on models/schemas barrels - ruff clean (93 fixes), MIT LICENSE, PLAN.md -> docs/, README Tests section - 300 tests pass, 93.7% coverage
28 lines
804 B
Python
28 lines
804 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
from ..db.database import get_db
|
|
from ..schemas.account import AccountStatsResponse
|
|
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 [] |