Skip to content

Commit

Permalink
Rename update_user_last_used_field
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Nov 15, 2023
1 parent c3b7493 commit 16bba40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def create_token(user_id: str):

async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
if token and '__U' in token:
current_user: schemas.UserBase = crud.update_user_by_token(db, token=token) # type: ignore
current_user: schemas.UserBase = crud.update_user_last_used_field(db, token=token) # type: ignore
if current_user:
return current_user
raise HTTPException(
Expand Down
2 changes: 1 addition & 1 deletion app/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_user(db: Session, user: UserBase):
return db_user


def update_user_by_token(db: Session, token: str):
def update_user_last_used_field(db: Session, token: str):
db_user = get_user_by_token(db, token=token)
if db_user:
db.query(User).filter(User.user_id == db_user.user_id).update({"last_used": func.now()})
Expand Down

0 comments on commit 16bba40

Please sign in to comment.