diff --git a/api/app/controllers/auth_routes.py b/api/app/controllers/auth_routes.py index 49e9a77..44ede53 100644 --- a/api/app/controllers/auth_routes.py +++ b/api/app/controllers/auth_routes.py @@ -42,4 +42,3 @@ async def auth_user( ) return {"access_token": access_token, "refresh_token": None} - diff --git a/api/app/controllers/register_routes.py b/api/app/controllers/register_routes.py new file mode 100644 index 0000000..ef686a8 --- /dev/null +++ b/api/app/controllers/register_routes.py @@ -0,0 +1,22 @@ +from fastapi import APIRouter, Depends, HTTPException, Response, status +from sqlalchemy.ext.asyncio import AsyncSession + +from app.database.session import get_db +from app.domain.entities.register import RegisterEntity +from app.infrastructure.auth_service import AuthService + +router = APIRouter() + + +@router.post( + "/register/", + response_model=dict, + summary="Регистрация пользователя", + description="Производит регистрацию пользователя в системе.", +) +async def register_user( + response: Response, + user_data: RegisterEntity, + db: AsyncSession = Depends(get_db) +): + return {} diff --git a/api/app/domain/entities/auth.py b/api/app/domain/entities/auth.py index fc3dd35..a36b80a 100644 --- a/api/app/domain/entities/auth.py +++ b/api/app/domain/entities/auth.py @@ -2,6 +2,6 @@ from pydantic import BaseModel, Field class AuthEntity(BaseModel): - login: str = Field(..., example="user@example.com") - password: str = Field(..., min_length=5, example="strongpassword") + login: str = Field(..., example='user@example.com') + password: str = Field(..., min_length=5, example='strongpassword') diff --git a/api/app/domain/entities/register.py b/api/app/domain/entities/register.py new file mode 100644 index 0000000..f6a479d --- /dev/null +++ b/api/app/domain/entities/register.py @@ -0,0 +1,12 @@ +from typing import Optional + +from pydantic import BaseModel, Field + + +class RegisterEntity(BaseModel): + first_name: str = Field(..., example='Ivan') + last_name: str = Field(..., example='Ivanov') + patronymic: Optional[str] = Field(None, example='Ivanov') + role_id: int = Field(..., example=1) + login: str = Field(..., example='user@example.com') + password: str = Field(..., min_length=5, example='strongpassword') diff --git a/api/app/main.py b/api/app/main.py index b95ef02..3d8bd08 100644 --- a/api/app/main.py +++ b/api/app/main.py @@ -2,6 +2,7 @@ from fastapi import FastAPI from starlette.middleware.cors import CORSMiddleware from app.controllers.auth_routes import router as auth_router +from app.controllers.register_routes import router as register_router from app.settings import settings @@ -17,6 +18,7 @@ def start_app(): ) api_app.include_router(auth_router, prefix=settings.APP_PREFIX) + api_app.include_router(register_router, prefix=settings.APP_PREFIX) return api_app