repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | from app.database import get_db |
| #2 | from app.models import App, Memory, MemoryState, User |
| #3 | from fastapi import APIRouter, Depends, HTTPException |
| #4 | from sqlalchemy.orm import Session |
| #5 | |
| #6 | router = APIRouter(prefix="/api/v1/stats", tags=["stats"]) |
| #7 | |
| #8 | @router.get("/") |
| #9 | async def get_profile( |
| #10 | user_id: str, |
| #11 | db: Session = Depends(get_db) |
| #12 | ): |
| #13 | user = db.query(User).filter(User.user_id == user_id).first() |
| #14 | if not user: |
| #15 | raise HTTPException(status_code=404, detail="User not found") |
| #16 | |
| #17 | # Get total number of memories |
| #18 | total_memories = db.query(Memory).filter(Memory.user_id == user.id, Memory.state != MemoryState.deleted).count() |
| #19 | |
| #20 | # Get total number of apps |
| #21 | apps = db.query(App).filter(App.owner == user) |
| #22 | total_apps = apps.count() |
| #23 | |
| #24 | return { |
| #25 | "total_memories": total_memories, |
| #26 | "total_apps": total_apps, |
| #27 | "apps": apps.all() |
| #28 | } |
| #29 | |
| #30 |