diff --git a/endpoints/login.post.py b/endpoints/login.post.py index d87c940..9b0c7c9 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -2,12 +2,12 @@ from fastapi import APIRouter, Depends, HTTPException, status from sqlalchemy.orm import Session from core.database import get_db from models.user import User -from schemas.user import UserSchema, UserLogin -from helpers.auth_helpers import authenticate_user, create_access_token +from schemas.user import UserLogin, UserResponse +from helpers.user_helpers import authenticate_user, create_access_token router = APIRouter() -@router.post("/login", status_code=200) +@router.post("/login", status_code=200, response_model=UserResponse) async def login( user_credentials: UserLogin, db: Session = Depends(get_db) @@ -21,4 +21,4 @@ async def login( ) access_token = create_access_token(data={"sub": user.username}) - return {"access_token": access_token, "token_type": "bearer"} \ No newline at end of file + return {"access_token": access_token, "token_type": "bearer", "user": user} \ No newline at end of file