feat: Add dashboard API endpoints and service for sound statistics
This commit is contained in:
@@ -5,6 +5,7 @@ from fastapi import APIRouter
|
||||
from app.api.v1 import (
|
||||
admin,
|
||||
auth,
|
||||
dashboard,
|
||||
extractions,
|
||||
files,
|
||||
main,
|
||||
@@ -19,6 +20,7 @@ api_router = APIRouter(prefix="/v1")
|
||||
|
||||
# Include all route modules
|
||||
api_router.include_router(auth.router, tags=["authentication"])
|
||||
api_router.include_router(dashboard.router, tags=["dashboard"])
|
||||
api_router.include_router(extractions.router, tags=["extractions"])
|
||||
api_router.include_router(files.router, tags=["files"])
|
||||
api_router.include_router(main.router, tags=["main"])
|
||||
|
||||
29
app/api/v1/dashboard.py
Normal file
29
app/api/v1/dashboard.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Dashboard API endpoints."""
|
||||
|
||||
from typing import Annotated, Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from app.core.dependencies import get_current_user, get_dashboard_service
|
||||
from app.models.user import User
|
||||
from app.services.dashboard import DashboardService
|
||||
|
||||
router = APIRouter(prefix="/dashboard", tags=["dashboard"])
|
||||
|
||||
|
||||
@router.get("/soundboard-statistics")
|
||||
async def get_soundboard_statistics(
|
||||
_current_user: Annotated[User, Depends(get_current_user)],
|
||||
dashboard_service: Annotated[DashboardService, Depends(get_dashboard_service)],
|
||||
) -> dict[str, Any]:
|
||||
"""Get soundboard statistics."""
|
||||
return await dashboard_service.get_soundboard_statistics()
|
||||
|
||||
|
||||
@router.get("/track-statistics")
|
||||
async def get_track_statistics(
|
||||
_current_user: Annotated[User, Depends(get_current_user)],
|
||||
dashboard_service: Annotated[DashboardService, Depends(get_dashboard_service)],
|
||||
) -> dict[str, Any]:
|
||||
"""Get track statistics."""
|
||||
return await dashboard_service.get_track_statistics()
|
||||
Reference in New Issue
Block a user