Files
track/backend/app/api/v1/endpoints/dashboard.py

25 lines
788 B
Python
Raw Normal View History

"""Dashboard API"""
from fastapi import APIRouter, Depends, Query
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.database import get_db
from app.services.dashboard_service import (
get_dashboard_stats, DashboardStats,
get_recent_activity, RecentActivity,
)
router = APIRouter(prefix="/dashboard", tags=["管理看板"])
@router.get("/stats", response_model=DashboardStats)
async def dashboard_stats(db: AsyncSession = Depends(get_db)):
return await get_dashboard_stats(db)
@router.get("/recent-activity", response_model=list[RecentActivity])
async def recent_activity(
limit: int = Query(10, ge=1, le=50),
db: AsyncSession = Depends(get_db),
):
"""最近任务动态 — 看板活动时间线"""
return await get_recent_activity(db, limit)