mirror of
https://github.com/furyhawk/ai_agent.git
synced 2026-07-21 02:05:42 +00:00
- Implemented `conversation-store` for managing conversations and messages. - Created `file-preview-store` to handle file preview state. - Added `sidebar-store` for sidebar visibility management. - Developed `theme-store` for theme persistence and management. - Introduced `kb-selection-store` for managing active knowledge base selections with persistence. chore: define API and chat types - Added types for API responses, authentication, chat messages, conversations, and projects. - Defined interfaces for various entities including users, sessions, and message ratings. build: configure TypeScript and testing setup - Set up `tsconfig.json` for TypeScript configuration. - Created `vitest.config.ts` for testing configuration with Vitest. - Added `vitest.setup.ts` for global test setup including mocks for Next.js router and media queries. - Configured Vercel deployment settings in `vercel.json`.
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Admin observability — workspace stats + Stripe event log."""
|
|
|
|
from typing import Any
|
|
|
|
from fastapi import APIRouter, Query
|
|
|
|
from app.api.deps import AdminSvc, CurrentAdmin
|
|
from app.schemas.admin import AdminStats, StripeEventList, StripeEventRead
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/stats", response_model=AdminStats)
|
|
async def get_admin_stats(
|
|
service: AdminSvc,
|
|
_user: CurrentAdmin,
|
|
) -> Any:
|
|
"""Aggregate workspace metrics. Billing fields are 0 when billing is
|
|
disabled in the deployment."""
|
|
return await service.workspace_stats()
|
|
|
|
|
|
@router.get("/stripe-events", response_model=StripeEventList)
|
|
async def list_stripe_events(
|
|
service: AdminSvc,
|
|
_user: CurrentAdmin,
|
|
skip: int = Query(0, ge=0),
|
|
limit: int = Query(50, ge=1, le=200),
|
|
) -> Any:
|
|
"""List recent Stripe webhook events from the idempotency log.
|
|
|
|
Best-effort: returns empty list when the StripeEvent table doesn't exist
|
|
(billing disabled in this deployment).
|
|
"""
|
|
rows, total = await service.list_stripe_events(skip=skip, limit=limit)
|
|
items = [StripeEventRead.model_validate(row) for row in rows]
|
|
return StripeEventList(items=items, total=total)
|