feat: add topic summaries and growth profiles
This commit is contained in:
@@ -9,6 +9,7 @@ from app.core.responses import api_success
|
||||
from app.models.user import User
|
||||
from app.schemas.user import UserProfile
|
||||
from app.services.entitlement_service import EntitlementService, entitlement_dict
|
||||
from app.services.growth_profile_service import GrowthProfileService, growth_profile_dict
|
||||
from app.services.topic_session_service import TopicSessionService
|
||||
|
||||
router = APIRouter()
|
||||
@@ -27,3 +28,28 @@ def profile(
|
||||
)
|
||||
data["entitlement"] = entitlement_dict(view)
|
||||
return api_success(data)
|
||||
|
||||
|
||||
@router.get("/growth-profile")
|
||||
def growth_profile(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> dict:
|
||||
profile = GrowthProfileService.get_growth_profile(db, current_user.id)
|
||||
summaries = GrowthProfileService.recent_topic_summaries(db, current_user.id, limit=10)
|
||||
return api_success(
|
||||
{
|
||||
"profile": growth_profile_dict(profile),
|
||||
"recentSummaries": [
|
||||
{
|
||||
"id": item.id,
|
||||
"topicSessionId": item.topic_session_id,
|
||||
"summary": item.summary,
|
||||
"recommendedHomework": item.recommended_homework,
|
||||
"nextObservation": item.next_observation,
|
||||
"generatedAt": item.generated_at,
|
||||
}
|
||||
for item in summaries
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user