Update code in endpoints/login.post.py

This commit is contained in:
Backend IM Bot 2025-03-28 19:13:08 +00:00
parent e6f036237c
commit e9a0d9ac62

View File

@ -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 schemas.user import UserLogin, UserResponse
from helpers.auth_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.email})
return {"access_token": access_token, "token_type": "bearer"}
return {"access_token": access_token, "token_type": "bearer", "user": user}