diff --git a/lunchtime14/lunchtime14.ipynb b/lunchtime14/lunchtime14.ipynb index b3e4115..a0942cf 100644 --- a/lunchtime14/lunchtime14.ipynb +++ b/lunchtime14/lunchtime14.ipynb @@ -523,7 +523,9 @@ "\n", "@app.get(\"/users/\", response_model=list[UserRead])\n", "def read_users(\n", - " session: SessionDep, offset: int = 0, limit: int = Query(default=100, le=100)\n", + " session: SessionDep,\n", + " offset: int = 0,\n", + " limit: int = Query(default=100, le=100),\n", "):\n", " users = session.exec(select(User).offset(offset).limit(limit)).all()\n", " return users" @@ -585,7 +587,8 @@ "\n", "@app.post(\"/users/\", response_model=UserRead)\n", "def create_user(session: SessionDep, user: UserCreate):\n", - " extra_data = {\"password_hash\": PasswordHasher().hash(user.password)}\n", + " password_hash = PasswordHasher().hash(user.password)\n", + " extra_data = {\"password_hash\": password_hash}\n", " user_db = User.model_validate(user, update=extra_data)\n", " session.add(user_db)\n", " session.commit()\n", @@ -611,7 +614,8 @@ " user_db = read_user(session, user_id)\n", " user_data = user.model_dump(exclude_unset=True)\n", " if user.password:\n", - " user_data[\"password_hash\"] = PasswordHasher().hash(user.password)\n", + " password_hash = PasswordHasher().hash(user.password)\n", + " user_data[\"password_hash\"] = password_hash\n", " user_db.sqlmodel_update(user_data)\n", " session.add(user_db)\n", " session.commit()\n",