Skip to content

Commit

Permalink
fix: 404 error in active-next endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMohammad20000 authored Jan 14, 2025
1 parent 79ca07f commit 1ce8c21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/routers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,15 @@ def active_next_plan(
dbuser: UserResponse = Depends(get_validated_user),
):
"""Reset user by next plan"""
dbuser = crud.reset_user_by_next(db=db, dbuser=dbuser)

if (dbuser is None or dbuser.next_plan is None):
raise HTTPException(
status_code=404,
detail=f"User doesn't have next plan",
)

dbuser = crud.reset_user_by_next(db=db, dbuser=dbuser)

if dbuser.status in [UserStatus.active, UserStatus.on_hold]:
bg.add_task(xray.operations.add_user, dbuser=dbuser)

Expand Down

0 comments on commit 1ce8c21

Please sign in to comment.