from fastapi import APIRouter, HTTPException, status from schemas.user import UserLogin from helpers.auth_helpers import authenticate_user router = APIRouter() @router.post("/login", status_code=status.HTTP_200_OK) async def login(user_data: UserLogin): """Authenticate user""" user = authenticate_user(user_data) if not user: raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid credentials") return user