From 16bba407557afef4c5f6aad6a514d7917bd86824 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Wed, 15 Nov 2023 14:52:09 +0100 Subject: [PATCH] Rename update_user_last_used_field --- app/api.py | 2 +- app/crud.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api.py b/app/api.py index 864b5ecc..93729c5c 100644 --- a/app/api.py +++ b/app/api.py @@ -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( diff --git a/app/crud.py b/app/crud.py index e1738bfd..efb39975 100644 --- a/app/crud.py +++ b/app/crud.py @@ -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()})