19 lines
548 B
Python
19 lines
548 B
Python
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from backend.session import get_session
|
|
from schemas.auth import AuthLoginRequest, AuthLoginResponse
|
|
from services.auth import AuthService
|
|
|
|
auth_router = APIRouter(
|
|
prefix='/auth',
|
|
tags=['auth'],
|
|
)
|
|
|
|
|
|
@auth_router.post('/login', response_model=AuthLoginResponse)
|
|
async def login(request: AuthLoginRequest, session: Annotated[AsyncSession, Depends(get_session)]):
|
|
return await AuthService(session).authenticate(request)
|