Fix onboarding process not getting the subcription plan
This commit is contained in:
@@ -360,12 +360,12 @@ async def get_user_progress(
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Get current user's onboarding progress"""
|
||||
|
||||
|
||||
try:
|
||||
onboarding_service = OnboardingService(db)
|
||||
progress = await onboarding_service.get_user_progress(current_user["user_id"])
|
||||
return progress
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Get onboarding progress error: {e}")
|
||||
raise HTTPException(
|
||||
@@ -373,6 +373,39 @@ async def get_user_progress(
|
||||
detail="Failed to get onboarding progress"
|
||||
)
|
||||
|
||||
@router.get("/{user_id}/onboarding/progress", response_model=UserProgress)
|
||||
async def get_user_progress_by_id(
|
||||
user_id: str,
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
Get onboarding progress for a specific user
|
||||
Available for service-to-service calls and admin users
|
||||
"""
|
||||
|
||||
# Allow service tokens or admin users
|
||||
user_type = current_user.get("type", "user")
|
||||
user_role = current_user.get("role", "user")
|
||||
|
||||
if user_type != "service" and user_role not in ["admin", "super_admin"]:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Insufficient permissions to access other users' onboarding progress"
|
||||
)
|
||||
|
||||
try:
|
||||
onboarding_service = OnboardingService(db)
|
||||
progress = await onboarding_service.get_user_progress(user_id)
|
||||
return progress
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Get onboarding progress error for user {user_id}: {e}")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Failed to get onboarding progress"
|
||||
)
|
||||
|
||||
@router.put("/me/onboarding/step", response_model=UserProgress)
|
||||
async def update_onboarding_step(
|
||||
update_request: UpdateStepRequest,
|
||||
|
||||
Reference in New Issue
Block a user