fix ignore
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from app.db.database import get_db
|
||||
from app.modules.auth.models.user_model import User
|
||||
from app.modules.documents.models.document_model import Project
|
||||
from app.modules.drive.models.drive_model import DriveFile
|
||||
from app.middleware.auth import get_current_user
|
||||
|
||||
router = APIRouter(prefix="/stats", tags=["Stats"])
|
||||
|
||||
@router.get("/dashboard")
|
||||
async def get_dashboard_stats(
|
||||
current_user: User = Depends(get_current_user),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
Get dashboard statistics for the logged-in user.
|
||||
"""
|
||||
project_count = db.query(Project).filter(Project.user_id == current_user.id).count()
|
||||
file_count = db.query(DriveFile).filter(DriveFile.owner_id == current_user.id).count()
|
||||
|
||||
return {
|
||||
"projects_count": project_count,
|
||||
"files_count": file_count,
|
||||
"storage_used": 0,
|
||||
"subscription": current_user.subscription
|
||||
}
|
||||
Reference in New Issue
Block a user