(
session: SessionDep,
current_user: CurrentUser,
collection_id: uuid.UUID,
limit: int = Query(
30, description="Maximum number of recent sessions to return", ge=1, le=90
),
)
| 14 | |
| 15 | @router.get("/collections/{collection_id}/stats", response_model=CollectionStats) |
| 16 | def get_collection_statistics_endpoint( |
| 17 | session: SessionDep, |
| 18 | current_user: CurrentUser, |
| 19 | collection_id: uuid.UUID, |
| 20 | limit: int = Query( |
| 21 | 30, description="Maximum number of recent sessions to return", ge=1, le=90 |
| 22 | ), |
| 23 | ) -> Any: |
| 24 | if not check_collection_access(session, collection_id, current_user.id): |
| 25 | raise HTTPException(status_code=404, detail="Collection not found") |
| 26 | |
| 27 | try: |
| 28 | statistics = get_collection_stats( |
| 29 | session=session, |
| 30 | collection_id=collection_id, |
| 31 | limit=limit, |
| 32 | ) |
| 33 | return statistics |
| 34 | except ValueError as e: |
| 35 | raise HTTPException(status_code=404, detail=str(e)) |
| 36 | except Exception: |
| 37 | raise HTTPException( |
| 38 | status_code=500, detail="Error retrieving collection statistics" |
| 39 | ) |
nothing calls this directly
no test coverage detected