diff --git a/backend/app/views/auth/api.py b/backend/app/views/auth/api.py index 7f51807..f0f0a26 100644 --- a/backend/app/views/auth/api.py +++ b/backend/app/views/auth/api.py @@ -63,7 +63,7 @@ async def register( return user -@router.get("/users/me/", response_model=schemas.User) +@router.get("/me", response_model=schemas.User) async def read_users_me( current_user: Annotated[schemas.User, Depends(services.get_current_active_user)], ): diff --git a/backend/app/views/auth/services.py b/backend/app/views/auth/services.py index ce5f467..bdef656 100644 --- a/backend/app/views/auth/services.py +++ b/backend/app/views/auth/services.py @@ -3,8 +3,9 @@ from fastapi.security import OAuth2PasswordBearer from sqlalchemy.orm import Session from jose import JWTError, jwt from typing import Annotated, Union -from datetime import timedelta +from datetime import datetime, timezone, timedelta from passlib.context import CryptContext +import uuid from ...db import models from . import schemas @@ -23,7 +24,7 @@ def get_password_hash(password): return pwd_context.hash(password) -def get_user_by_id(db: Session, user_id: int): +def get_user_by_id(db: Session, user_id: uuid.uuid4): return db.query(models.User).filter(models.User.id == user_id).first()