Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Nov 29, 2024
1 parent c0247ee commit 0606d44
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lunchtime14/lunchtime14.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 0606d44

Please sign in to comment.