From 1ce8c216657675170f5248419819ca5a0b06da32 Mon Sep 17 00:00:00 2001 From: Mohammad Date: Wed, 15 Jan 2025 00:18:00 +0330 Subject: [PATCH] fix: 404 error in active-next endpoint #1568 --- app/routers/user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/routers/user.py b/app/routers/user.py index e5bcdf81..e8273e35 100644 --- a/app/routers/user.py +++ b/app/routers/user.py @@ -275,7 +275,6 @@ 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( @@ -283,6 +282,8 @@ def active_next_plan( 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)