fix: route ordering customer/{id}/health before /{id}; CustomerHealthService for health-overview; keywords/competitor Header decorator; onboarding product_info dict; marketing template fallback; frontend style-switching tabs
This commit is contained in:
@@ -57,6 +57,28 @@ async def get_all_health_scores(
|
||||
return {"items": await service.get_all_health_scores(user_id)}
|
||||
|
||||
|
||||
@router.get("/{customer_id}/health")
|
||||
async def get_customer_health(
|
||||
customer_id: str,
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = CustomerHealthService(db)
|
||||
return await service.get_customer_health(user_id, customer_id)
|
||||
|
||||
|
||||
@router.get("/{customer_id}/conversation")
|
||||
async def get_conversation(
|
||||
customer_id: str,
|
||||
page: int = 1,
|
||||
size: int = 20,
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = CustomerService(db)
|
||||
return await service.get_conversation(user_id, customer_id, page, size)
|
||||
|
||||
|
||||
@router.get("/{customer_id}")
|
||||
async def get_customer(
|
||||
customer_id: str,
|
||||
@@ -165,27 +187,3 @@ async def export_customers(
|
||||
headers={"Content-Disposition": "attachment; filename=customers.csv"},
|
||||
)
|
||||
|
||||
|
||||
@router.get("/{customer_id}/health")
|
||||
async def get_customer_health(
|
||||
customer_id: str,
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = CustomerHealthService(db)
|
||||
health = await service.get_customer_health(user_id, customer_id)
|
||||
if not health:
|
||||
raise HTTPException(status_code=404, detail="Customer not found")
|
||||
return health
|
||||
|
||||
|
||||
@router.get("/{customer_id}/conversation")
|
||||
async def get_conversation(
|
||||
customer_id: str,
|
||||
page: int = Query(1, ge=1),
|
||||
size: int = Query(50, ge=1, le=200),
|
||||
user_id: str = Depends(get_current_user_id),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
service = CustomerService(db)
|
||||
return await service.get_conversation(user_id, customer_id, page, size)
|
||||
|
||||
Reference in New Issue
Block a user