ソースを参照

Bugfixes for user, vehicle

main
Madiwka 1年前
コミット
6f328d4f1b
1個のファイルの変更5行の追加3行の削除
  1. +5
    -3
      app/apis/v1/route_user.py

+ 5
- 3
app/apis/v1/route_user.py ファイルの表示

@@ -30,7 +30,7 @@ def create_user(
if user.Role not in settings.ALLOWED_ROLES:
raise HTTPException(
status_code=400,
detail=f"Status {status} is not allowed. Allowed status are {settings.ALLOWED_TASK_STATUS}",
detail=f"Role {user.Role} is not allowed. Allowed roles are {settings.ALLOWED_ROLES}",
)
if current_user.Role != "Admin":
raise HTTPException(
@@ -76,7 +76,9 @@ def update_user(
raise HTTPException(
status_code=403, detail="You are not authorized to perform this action"
)
user = replace_user_data(user_id=user_id, user=user, db=db)
user = replace_user_data(user_id=user_id, user_data=user, db=db)
if user == "userNotFound":
raise HTTPException(status_code=404, detail="User not found")
return user


@@ -91,7 +93,7 @@ def get_user_me(

@router.get("/{user_id}", response_model=ShowUser, status_code=status.HTTP_200_OK)
def get_user(user_id: int, db: Session = Depends(get_db)):
user = get_user_by_id(user_id=user_id, db=db)
user = get_user_by_id(user_id=user_id, role="Any", db=db)
if not user:
raise HTTPException(status_code=404, detail="User not found")
return user


読み込み中…
キャンセル
保存