MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / get_collection_statistics_endpoint

Function get_collection_statistics_endpoint

backend/src/stats/api.py:16–39  ·  view source on GitHub ↗
(
    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
    ),
)

Source from the content-addressed store, hash-verified

14
15@router.get("/collections/{collection_id}/stats", response_model=CollectionStats)
16def 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 )

Callers

nothing calls this directly

Calls 2

check_collection_accessFunction · 0.90
get_collection_statsFunction · 0.85

Tested by

no test coverage detected