diff --git a/Dockerfile b/Dockerfile index ebf94bd..1c7174b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,22 +20,21 @@ RUN apt-get update \ WORKDIR $PYSETUP_PATH -COPY ./pyproject.toml . +# due to the installation of the project itself, it should contain all the files +COPY . . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir setuptools wheel \ && pip install --no-cache-dir poetry -RUN poetry install --no-root --only main +RUN poetry install --only main FROM python-base as production COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH -RUN apt-get update && apt-get install -y curl - WORKDIR decision-making-app/ COPY . /decision-making-app/ -CMD ["python", "-Om", "src.app"] +CMD ["python", "-Om", "dma"] diff --git a/alembic.ini b/alembic.ini index c33f3ff..949d672 100644 --- a/alembic.ini +++ b/alembic.ini @@ -2,7 +2,7 @@ [alembic] # path to migration scripts -script_location = ./src/app/infrastructure/database/migrations +script_location = ./src/dma/infrastructure/database/migrations # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s # Uncomment the line below if you want the files to be prepended with date and time diff --git a/docker-compose.yml b/docker-compose.yml index 6c14cc7..217ee4e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: - ./config:/decision_making_app/config:ro environment: CONFIG_PATH: ${CONFIG_PATH:-./config/local.ini} - command: [ "python", "-Om", "src.app" ] + command: [ "python", "-Om", "dma" ] healthcheck: test: [ "CMD-SHELL", "curl -fsSL http://localhost:5000/healthcheck/" ] interval: 10s @@ -73,10 +73,10 @@ services: volumes: - ./config:/decision_making_app/config:ro - ./alembic.ini:/decision_making_app/alembic.ini:ro - - ./src/app/infrastructure/database/migrations:/decision_making_app/src/app/infrastructure/database/migrations:ro + - ./src/dma/infrastructure/database/migrations:/decision_making_app/src/dma/infrastructure/database/migrations:ro environment: CONFIG_PATH: ${CONFIG_PATH:-./config/local.ini} - command: [ "python", "-m", "alembic", "upgrade", "head" ] + command: [ "python", "-Om", "alembic", "upgrade", "head" ] minio: profiles: [ "api" ] @@ -94,11 +94,15 @@ services: MINIO_ROOT_USER: ${MINIO_ROOT_USER:-decision_making_app_admin} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-decision_making_app_admin} healthcheck: - test: [ "CMD-SHELL", "curl -I http://localhost:9000/minio/health/live" ] - interval: 10s - timeout: 60s + test: [ "CMD", "mc", "ready", "local" ] + interval: 5s + timeout: 5s retries: 5 - start_period: 10s +# test: [ "CMD-SHELL", "curl -I http://localhost:9000/minio/health/live" ] +# interval: 10s +# timeout: 60s +# retries: 5 +# start_period: 10s rabbitmq: profiles: [ "api" ] diff --git a/pyproject.toml b/pyproject.toml index 3b0f9f2..bdbaa14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,11 @@ description = "" authors = ["hrimov "] readme = "README.md" packages = [ - { include = "app", from = "src" } + { include = "dma", from = "src" } ] [tool.poetry.scripts] -api = "src.app.__main__:run" +api = "src.dma.__main__:run" [tool.poetry.dependencies] python = "^3.11" @@ -50,16 +50,12 @@ asyncio_mode = "auto" addopts = "-vv --order-scope=module" -[tool.mypy] -explicit_package_bases = true - - [tool.ruff] select = ["ALL"] ignore = ["A003", "ANN", "D", "FA100", "FA102", "FIX", "I", "PGH003", "PGH004", "TD"] [tool.ruff.extend-per-file-ignores] -"src/app/infrastructure/database/migrations/versions/*" = ["ALL"] +"src/dma/infrastructure/database/migrations/versions/*" = ["ALL"] "tests/*" = ["ARG001", "F401", "PT003", "PT004", "S"] diff --git a/src/app/__init__.py b/src/dma/__init__.py similarity index 100% rename from src/app/__init__.py rename to src/dma/__init__.py diff --git a/src/app/__main__.py b/src/dma/__main__.py similarity index 64% rename from src/app/__main__.py rename to src/dma/__main__.py index a9dafb1..75d6238 100644 --- a/src/app/__main__.py +++ b/src/dma/__main__.py @@ -1,4 +1,4 @@ -from src.app.presentation.api import v1 +from dma.presentation.api import v1 def run() -> None: diff --git a/src/app/application/__init__.py b/src/dma/application/__init__.py similarity index 100% rename from src/app/application/__init__.py rename to src/dma/application/__init__.py diff --git a/src/app/application/comment/__init__.py b/src/dma/application/comment/__init__.py similarity index 100% rename from src/app/application/comment/__init__.py rename to src/dma/application/comment/__init__.py diff --git a/src/app/application/comment/dto.py b/src/dma/application/comment/dto.py similarity index 83% rename from src/app/application/comment/dto.py rename to src/dma/application/comment/dto.py index 029ca6a..4fc4812 100644 --- a/src/app/application/comment/dto.py +++ b/src/dma/application/comment/dto.py @@ -2,11 +2,11 @@ from datetime import datetime from typing import List, TYPE_CHECKING -from src.app.application.common.dto import DTO +from dma.application.common.dto import DTO if TYPE_CHECKING: - from src.app.application.problem.dto import ProblemMember, ProblemStatement - from src.app.application.stage.dto import Result, Suggestion + from dma.application.problem.dto import ProblemMember, ProblemStatement + from dma.application.stage.dto import Result, Suggestion @dataclass(frozen=True) diff --git a/src/app/application/comment/exceptions.py b/src/dma/application/comment/exceptions.py similarity index 100% rename from src/app/application/comment/exceptions.py rename to src/dma/application/comment/exceptions.py diff --git a/src/app/application/comment/interfaces.py b/src/dma/application/comment/interfaces.py similarity index 100% rename from src/app/application/comment/interfaces.py rename to src/dma/application/comment/interfaces.py diff --git a/src/app/application/common/__init__.py b/src/dma/application/common/__init__.py similarity index 100% rename from src/app/application/common/__init__.py rename to src/dma/application/common/__init__.py diff --git a/src/app/application/common/dto.py b/src/dma/application/common/dto.py similarity index 100% rename from src/app/application/common/dto.py rename to src/dma/application/common/dto.py diff --git a/src/app/application/common/exceptions.py b/src/dma/application/common/exceptions.py similarity index 100% rename from src/app/application/common/exceptions.py rename to src/dma/application/common/exceptions.py diff --git a/src/app/application/common/filters.py b/src/dma/application/common/filters.py similarity index 100% rename from src/app/application/common/filters.py rename to src/dma/application/common/filters.py diff --git a/src/app/application/common/interfaces.py b/src/dma/application/common/interfaces.py similarity index 100% rename from src/app/application/common/interfaces.py rename to src/dma/application/common/interfaces.py diff --git a/src/app/application/common/pagination.py b/src/dma/application/common/pagination.py similarity index 96% rename from src/app/application/common/pagination.py rename to src/dma/application/common/pagination.py index 8287962..46fd613 100644 --- a/src/app/application/common/pagination.py +++ b/src/dma/application/common/pagination.py @@ -3,7 +3,7 @@ from enum import Enum from typing import Generic, List, TypeVar -from src.app.application.common.dto import DTO +from dma.application.common.dto import DTO Item = TypeVar("Item") diff --git a/src/app/application/problem/__init__.py b/src/dma/application/problem/__init__.py similarity index 100% rename from src/app/application/problem/__init__.py rename to src/dma/application/problem/__init__.py diff --git a/src/app/application/problem/dto.py b/src/dma/application/problem/dto.py similarity index 82% rename from src/app/application/problem/dto.py rename to src/dma/application/problem/dto.py index 68b9570..f2c76f5 100644 --- a/src/app/application/problem/dto.py +++ b/src/dma/application/problem/dto.py @@ -1,14 +1,14 @@ from dataclasses import dataclass from typing import List, TypeAlias, TYPE_CHECKING -from src.app.application.common.dto import DTO -from src.app.application.common.pagination import PaginatedItems +from dma.application.common.dto import DTO +from dma.application.common.pagination import PaginatedItems if TYPE_CHECKING: - from src.app.application.comment.dto import Comment, ProblemStatementComment - from src.app.application.stage.dto import Suggestion, SuggestionStage, VotingStage - from src.app.application.user.dto import User + from dma.application.comment.dto import Comment, ProblemStatementComment + from dma.application.stage.dto import Suggestion, SuggestionStage, VotingStage + from dma.application.user.dto import User @dataclass(frozen=True) diff --git a/src/app/application/problem/exceptions.py b/src/dma/application/problem/exceptions.py similarity index 92% rename from src/app/application/problem/exceptions.py rename to src/dma/application/problem/exceptions.py index 234ec80..a0ef96c 100644 --- a/src/app/application/problem/exceptions.py +++ b/src/dma/application/problem/exceptions.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from src.app.application.common.exceptions import DatabaseGatewayError +from dma.application.common.exceptions import DatabaseGatewayError class ProblemDatabaseGatewayError(DatabaseGatewayError): diff --git a/src/app/application/problem/filters.py b/src/dma/application/problem/filters.py similarity index 75% rename from src/app/application/problem/filters.py rename to src/dma/application/problem/filters.py index 384e796..cd34c39 100644 --- a/src/app/application/problem/filters.py +++ b/src/dma/application/problem/filters.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from src.app.application.common.filters import Filters +from dma.application.common.filters import Filters @dataclass(frozen=True) diff --git a/src/app/application/problem/interfaces.py b/src/dma/application/problem/interfaces.py similarity index 100% rename from src/app/application/problem/interfaces.py rename to src/dma/application/problem/interfaces.py diff --git a/src/app/application/stage/__init__.py b/src/dma/application/stage/__init__.py similarity index 100% rename from src/app/application/stage/__init__.py rename to src/dma/application/stage/__init__.py diff --git a/src/app/application/stage/dto.py b/src/dma/application/stage/dto.py similarity index 83% rename from src/app/application/stage/dto.py rename to src/dma/application/stage/dto.py index c5c8062..6083ca0 100644 --- a/src/app/application/stage/dto.py +++ b/src/dma/application/stage/dto.py @@ -1,12 +1,12 @@ from dataclasses import dataclass from typing import List, TYPE_CHECKING -from src.app.application.common.dto import DTO, StartedEndedAtMixin +from dma.application.common.dto import DTO, StartedEndedAtMixin if TYPE_CHECKING: - from src.app.application.comment.dto import ResultComment, SuggestionComment - from src.app.application.problem.dto import Problem + from dma.application.comment.dto import ResultComment, SuggestionComment + from dma.application.problem.dto import Problem @dataclass(frozen=True) diff --git a/src/app/application/stage/exceptions.py b/src/dma/application/stage/exceptions.py similarity index 100% rename from src/app/application/stage/exceptions.py rename to src/dma/application/stage/exceptions.py diff --git a/src/app/application/stage/interfaces.py b/src/dma/application/stage/interfaces.py similarity index 100% rename from src/app/application/stage/interfaces.py rename to src/dma/application/stage/interfaces.py diff --git a/src/app/application/user/__init__.py b/src/dma/application/user/__init__.py similarity index 100% rename from src/app/application/user/__init__.py rename to src/dma/application/user/__init__.py diff --git a/src/app/application/user/dto.py b/src/dma/application/user/dto.py similarity index 80% rename from src/app/application/user/dto.py rename to src/dma/application/user/dto.py index c7110a4..44d4906 100644 --- a/src/app/application/user/dto.py +++ b/src/dma/application/user/dto.py @@ -1,12 +1,12 @@ from dataclasses import dataclass from typing import List, TypeAlias, TYPE_CHECKING -from src.app.application.common.dto import DTO -from src.app.application.common.pagination import PaginatedItems +from dma.application.common.dto import DTO +from dma.application.common.pagination import PaginatedItems if TYPE_CHECKING: - from src.app.application.problem.dto import Problem, ProblemMember + from dma.application.problem.dto import Problem, ProblemMember @dataclass(frozen=True) diff --git a/src/app/application/user/exceptions.py b/src/dma/application/user/exceptions.py similarity index 88% rename from src/app/application/user/exceptions.py rename to src/dma/application/user/exceptions.py index 2601cb6..226874d 100644 --- a/src/app/application/user/exceptions.py +++ b/src/dma/application/user/exceptions.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from src.app.application.common.exceptions import DatabaseGatewayError +from dma.application.common.exceptions import DatabaseGatewayError class UserDatabaseGatewayError(DatabaseGatewayError): diff --git a/src/app/application/user/filters.py b/src/dma/application/user/filters.py similarity index 63% rename from src/app/application/user/filters.py rename to src/dma/application/user/filters.py index 697125d..fbc8aec 100644 --- a/src/app/application/user/filters.py +++ b/src/dma/application/user/filters.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from src.app.application.common.filters import Filters +from dma.application.common.filters import Filters @dataclass(frozen=True) diff --git a/src/app/application/user/interfaces.py b/src/dma/application/user/interfaces.py similarity index 82% rename from src/app/application/user/interfaces.py rename to src/dma/application/user/interfaces.py index b86f59a..7db9a5e 100644 --- a/src/app/application/user/interfaces.py +++ b/src/dma/application/user/interfaces.py @@ -2,9 +2,9 @@ from typing import Protocol -from src.app.application.common.pagination import Pagination -from src.app.application.user import dto -from src.app.application.user.filters import UserFilters +from dma.application.common.pagination import Pagination +from dma.application.user import dto +from dma.application.user.filters import UserFilters class UserGateway(Protocol): diff --git a/src/app/domain/__init__.py b/src/dma/domain/__init__.py similarity index 100% rename from src/app/domain/__init__.py rename to src/dma/domain/__init__.py diff --git a/src/app/infrastructure/__init__.py b/src/dma/infrastructure/__init__.py similarity index 100% rename from src/app/infrastructure/__init__.py rename to src/dma/infrastructure/__init__.py diff --git a/src/app/infrastructure/base.py b/src/dma/infrastructure/base.py similarity index 100% rename from src/app/infrastructure/base.py rename to src/dma/infrastructure/base.py diff --git a/src/app/infrastructure/config/__init__.py b/src/dma/infrastructure/config/__init__.py similarity index 100% rename from src/app/infrastructure/config/__init__.py rename to src/dma/infrastructure/config/__init__.py diff --git a/src/app/infrastructure/config/models/__init__.py b/src/dma/infrastructure/config/models/__init__.py similarity index 100% rename from src/app/infrastructure/config/models/__init__.py rename to src/dma/infrastructure/config/models/__init__.py diff --git a/src/app/infrastructure/config/models/application.py b/src/dma/infrastructure/config/models/application.py similarity index 100% rename from src/app/infrastructure/config/models/application.py rename to src/dma/infrastructure/config/models/application.py diff --git a/src/app/infrastructure/config/models/database.py b/src/dma/infrastructure/config/models/database.py similarity index 100% rename from src/app/infrastructure/config/models/database.py rename to src/dma/infrastructure/config/models/database.py diff --git a/src/app/infrastructure/config/models/main.py b/src/dma/infrastructure/config/models/main.py similarity index 100% rename from src/app/infrastructure/config/models/main.py rename to src/dma/infrastructure/config/models/main.py diff --git a/src/app/infrastructure/config/models/message_queue.py b/src/dma/infrastructure/config/models/message_queue.py similarity index 100% rename from src/app/infrastructure/config/models/message_queue.py rename to src/dma/infrastructure/config/models/message_queue.py diff --git a/src/app/infrastructure/config/models/object_storage.py b/src/dma/infrastructure/config/models/object_storage.py similarity index 100% rename from src/app/infrastructure/config/models/object_storage.py rename to src/dma/infrastructure/config/models/object_storage.py diff --git a/src/app/infrastructure/config/parsers/__init__.py b/src/dma/infrastructure/config/parsers/__init__.py similarity index 100% rename from src/app/infrastructure/config/parsers/__init__.py rename to src/dma/infrastructure/config/parsers/__init__.py diff --git a/src/app/infrastructure/config/parsers/main.py b/src/dma/infrastructure/config/parsers/main.py similarity index 97% rename from src/app/infrastructure/config/parsers/main.py rename to src/dma/infrastructure/config/parsers/main.py index 6d88338..78652d6 100644 --- a/src/app/infrastructure/config/parsers/main.py +++ b/src/dma/infrastructure/config/parsers/main.py @@ -1,7 +1,7 @@ import configparser import os -from src.app.infrastructure.config.models import ( +from dma.infrastructure.config.models import ( AppConfig, Config, DatabaseConfig, diff --git a/src/app/infrastructure/database/__init__.py b/src/dma/infrastructure/database/__init__.py similarity index 100% rename from src/app/infrastructure/database/__init__.py rename to src/dma/infrastructure/database/__init__.py diff --git a/src/app/infrastructure/database/converters/__init__.py b/src/dma/infrastructure/database/converters/__init__.py similarity index 100% rename from src/app/infrastructure/database/converters/__init__.py rename to src/dma/infrastructure/database/converters/__init__.py diff --git a/src/app/infrastructure/database/converters/problem.py b/src/dma/infrastructure/database/converters/problem.py similarity index 95% rename from src/app/infrastructure/database/converters/problem.py rename to src/dma/infrastructure/database/converters/problem.py index f578f7b..f489b5b 100644 --- a/src/app/infrastructure/database/converters/problem.py +++ b/src/dma/infrastructure/database/converters/problem.py @@ -1,7 +1,7 @@ from dataclasses import fields -from src.app.application.problem import dto -from src.app.infrastructure.database.models.problem import ( +from dma.application.problem import dto +from dma.infrastructure.database.models.problem import ( Problem as ProblemModel, ProblemState as ProblemStateModel, ) diff --git a/src/app/infrastructure/database/converters/user.py b/src/dma/infrastructure/database/converters/user.py similarity index 92% rename from src/app/infrastructure/database/converters/user.py rename to src/dma/infrastructure/database/converters/user.py index 097c442..7c32cea 100644 --- a/src/app/infrastructure/database/converters/user.py +++ b/src/dma/infrastructure/database/converters/user.py @@ -1,7 +1,7 @@ from dataclasses import fields -from src.app.application.user import dto -from src.app.infrastructure.database.models.user import User as UserModel +from dma.application.user import dto +from dma.infrastructure.database.models.user import User as UserModel def convert_db_model_to_user_dto(user_model: UserModel) -> dto.User: diff --git a/src/app/infrastructure/database/exception_mapper.py b/src/dma/infrastructure/database/exception_mapper.py similarity index 90% rename from src/app/infrastructure/database/exception_mapper.py rename to src/dma/infrastructure/database/exception_mapper.py index 6889d96..74d4a3c 100644 --- a/src/app/infrastructure/database/exception_mapper.py +++ b/src/dma/infrastructure/database/exception_mapper.py @@ -4,7 +4,7 @@ from sqlalchemy.exc import SQLAlchemyError -from src.app.application.common.exceptions import DatabaseGatewayError +from dma.application.common.exceptions import DatabaseGatewayError Param = ParamSpec("Param") diff --git a/src/app/infrastructure/database/factory.py b/src/dma/infrastructure/database/factory.py similarity index 91% rename from src/app/infrastructure/database/factory.py rename to src/dma/infrastructure/database/factory.py index 6a752f1..85b0ae4 100644 --- a/src/app/infrastructure/database/factory.py +++ b/src/dma/infrastructure/database/factory.py @@ -7,7 +7,7 @@ create_async_engine, ) -from src.app.infrastructure.config.models.database import DatabaseConfig +from dma.infrastructure.config.models.database import DatabaseConfig async def build_sa_engine( diff --git a/src/app/infrastructure/database/gateways/__init__.py b/src/dma/infrastructure/database/gateways/__init__.py similarity index 100% rename from src/app/infrastructure/database/gateways/__init__.py rename to src/dma/infrastructure/database/gateways/__init__.py diff --git a/src/app/infrastructure/database/gateways/base.py b/src/dma/infrastructure/database/gateways/base.py similarity index 100% rename from src/app/infrastructure/database/gateways/base.py rename to src/dma/infrastructure/database/gateways/base.py diff --git a/src/app/infrastructure/database/gateways/problem.py b/src/dma/infrastructure/database/gateways/problem.py similarity index 93% rename from src/app/infrastructure/database/gateways/problem.py rename to src/dma/infrastructure/database/gateways/problem.py index 80d80b0..ee50daa 100644 --- a/src/app/infrastructure/database/gateways/problem.py +++ b/src/dma/infrastructure/database/gateways/problem.py @@ -4,28 +4,28 @@ from sqlalchemy.exc import DBAPIError, IntegrityError from sqlalchemy.ext.asyncio import AsyncSession -from src.app.application.common.pagination import ( +from dma.application.common.pagination import ( LimitOffsetPagination, LimitOffsetPaginationResult, SortOrder, ) -from src.app.application.common.exceptions import DatabaseGatewayError -from src.app.application.problem import dto -from src.app.application.problem.filters import ProblemFilters, ProblemStateFilters -from src.app.application.problem.exceptions import ( +from dma.application.common.exceptions import DatabaseGatewayError +from dma.application.problem import dto +from dma.application.problem.filters import ProblemFilters, ProblemStateFilters +from dma.application.problem.exceptions import ( ProblemIdNotExists, ProblemStateIdNotExists, ProblemStateNameNotExists, ) -from src.app.infrastructure.database.converters.problem import ( +from dma.infrastructure.database.converters.problem import ( convert_db_model_to_problem_dto, convert_db_model_to_problem_state_dto, convert_problem_create_dto_to_db_model, convert_problem_state_create_dto_to_db_model, update_problem_fields, ) -from src.app.infrastructure.database.exception_mapper import exception_mapper -from src.app.infrastructure.database.models.problem import ( +from dma.infrastructure.database.exception_mapper import exception_mapper +from dma.infrastructure.database.models.problem import ( Problem as ProblemModel, ProblemState as ProblemStateModel, ) diff --git a/src/app/infrastructure/database/gateways/user.py b/src/dma/infrastructure/database/gateways/user.py similarity index 89% rename from src/app/infrastructure/database/gateways/user.py rename to src/dma/infrastructure/database/gateways/user.py index ed917d0..ef306ab 100644 --- a/src/app/infrastructure/database/gateways/user.py +++ b/src/dma/infrastructure/database/gateways/user.py @@ -3,25 +3,25 @@ from sqlalchemy import func, select, Select from sqlalchemy.exc import DBAPIError, IntegrityError -from src.app.application.common.pagination import ( +from dma.application.common.pagination import ( LimitOffsetPagination, LimitOffsetPaginationResult, SortOrder, ) -from src.app.application.common.exceptions import DatabaseGatewayError -from src.app.application.user import dto -from src.app.application.user.exceptions import ( +from dma.application.common.exceptions import DatabaseGatewayError +from dma.application.user import dto +from dma.application.user.exceptions import ( UserIdNotExists, UserNicknameNotExists, ) -from src.app.application.user.filters import UserFilters -from src.app.infrastructure.database.converters.user import ( +from dma.application.user.filters import UserFilters +from dma.infrastructure.database.converters.user import ( convert_db_model_to_user_dto, convert_user_create_dto_to_db_model, update_user_fields, ) -from src.app.infrastructure.database.exception_mapper import exception_mapper -from src.app.infrastructure.database.models.user import User as UserModel +from dma.infrastructure.database.exception_mapper import exception_mapper +from dma.infrastructure.database.models.user import User as UserModel from .base import SQLAlchemyGateway diff --git a/src/app/infrastructure/database/migrations/README b/src/dma/infrastructure/database/migrations/README similarity index 100% rename from src/app/infrastructure/database/migrations/README rename to src/dma/infrastructure/database/migrations/README diff --git a/src/app/infrastructure/database/migrations/__init__.py b/src/dma/infrastructure/database/migrations/__init__.py similarity index 100% rename from src/app/infrastructure/database/migrations/__init__.py rename to src/dma/infrastructure/database/migrations/__init__.py diff --git a/src/app/infrastructure/database/migrations/env.py b/src/dma/infrastructure/database/migrations/env.py similarity index 94% rename from src/app/infrastructure/database/migrations/env.py rename to src/dma/infrastructure/database/migrations/env.py index 8c09d32..47d19da 100644 --- a/src/app/infrastructure/database/migrations/env.py +++ b/src/dma/infrastructure/database/migrations/env.py @@ -7,8 +7,8 @@ from alembic import context -from src.app.infrastructure.config.parsers.main import load_config -from src.app.infrastructure.database.models.base import BaseModel +from dma.infrastructure.config.parsers.main import load_config +from dma.infrastructure.database.models.base import BaseModel # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/src/app/infrastructure/database/migrations/script.py.mako b/src/dma/infrastructure/database/migrations/script.py.mako similarity index 100% rename from src/app/infrastructure/database/migrations/script.py.mako rename to src/dma/infrastructure/database/migrations/script.py.mako diff --git a/src/app/infrastructure/database/migrations/versions/563a3bad61c9_initial.py b/src/dma/infrastructure/database/migrations/versions/563a3bad61c9_initial.py similarity index 100% rename from src/app/infrastructure/database/migrations/versions/563a3bad61c9_initial.py rename to src/dma/infrastructure/database/migrations/versions/563a3bad61c9_initial.py diff --git a/src/app/infrastructure/database/migrations/versions/bba922808903_add_problemstate_values.py b/src/dma/infrastructure/database/migrations/versions/bba922808903_add_problemstate_values.py similarity index 100% rename from src/app/infrastructure/database/migrations/versions/bba922808903_add_problemstate_values.py rename to src/dma/infrastructure/database/migrations/versions/bba922808903_add_problemstate_values.py diff --git a/src/app/infrastructure/database/models/__init__.py b/src/dma/infrastructure/database/models/__init__.py similarity index 100% rename from src/app/infrastructure/database/models/__init__.py rename to src/dma/infrastructure/database/models/__init__.py diff --git a/src/app/infrastructure/database/models/base.py b/src/dma/infrastructure/database/models/base.py similarity index 100% rename from src/app/infrastructure/database/models/base.py rename to src/dma/infrastructure/database/models/base.py diff --git a/src/app/infrastructure/database/models/comment.py b/src/dma/infrastructure/database/models/comment.py similarity index 100% rename from src/app/infrastructure/database/models/comment.py rename to src/dma/infrastructure/database/models/comment.py diff --git a/src/app/infrastructure/database/models/problem.py b/src/dma/infrastructure/database/models/problem.py similarity index 100% rename from src/app/infrastructure/database/models/problem.py rename to src/dma/infrastructure/database/models/problem.py diff --git a/src/app/infrastructure/database/models/problem_member.py b/src/dma/infrastructure/database/models/problem_member.py similarity index 100% rename from src/app/infrastructure/database/models/problem_member.py rename to src/dma/infrastructure/database/models/problem_member.py diff --git a/src/app/infrastructure/database/models/stage.py b/src/dma/infrastructure/database/models/stage.py similarity index 100% rename from src/app/infrastructure/database/models/stage.py rename to src/dma/infrastructure/database/models/stage.py diff --git a/src/app/infrastructure/database/models/user.py b/src/dma/infrastructure/database/models/user.py similarity index 100% rename from src/app/infrastructure/database/models/user.py rename to src/dma/infrastructure/database/models/user.py diff --git a/src/app/infrastructure/log/__init__.py b/src/dma/infrastructure/log/__init__.py similarity index 100% rename from src/app/infrastructure/log/__init__.py rename to src/dma/infrastructure/log/__init__.py diff --git a/src/app/infrastructure/log/formatters/__init__.py b/src/dma/infrastructure/log/formatters/__init__.py similarity index 100% rename from src/app/infrastructure/log/formatters/__init__.py rename to src/dma/infrastructure/log/formatters/__init__.py diff --git a/src/app/infrastructure/log/formatters/main.py b/src/dma/infrastructure/log/formatters/main.py similarity index 100% rename from src/app/infrastructure/log/formatters/main.py rename to src/dma/infrastructure/log/formatters/main.py diff --git a/src/app/infrastructure/log/main.py b/src/dma/infrastructure/log/main.py similarity index 77% rename from src/app/infrastructure/log/main.py rename to src/dma/infrastructure/log/main.py index 925fdc4..12beb19 100644 --- a/src/app/infrastructure/log/main.py +++ b/src/dma/infrastructure/log/main.py @@ -1,7 +1,7 @@ import logging -from src.app.infrastructure.config.models.application import AppConfig -from src.app.infrastructure.log.formatters import MainConsoleFormatter +from dma.infrastructure.config.models.application import AppConfig +from dma.infrastructure.log.formatters import MainConsoleFormatter DEFAULT_LOGGING_LEVEL: int = logging.INFO diff --git a/src/app/infrastructure/message_queue/__init__.py b/src/dma/infrastructure/message_queue/__init__.py similarity index 100% rename from src/app/infrastructure/message_queue/__init__.py rename to src/dma/infrastructure/message_queue/__init__.py diff --git a/src/app/infrastructure/message_queue/gateway.py b/src/dma/infrastructure/message_queue/gateway.py similarity index 96% rename from src/app/infrastructure/message_queue/gateway.py rename to src/dma/infrastructure/message_queue/gateway.py index 21ade82..56c4a3f 100644 --- a/src/app/infrastructure/message_queue/gateway.py +++ b/src/dma/infrastructure/message_queue/gateway.py @@ -17,8 +17,8 @@ ) from aio_pika.pool import Pool -from src.app.infrastructure.config.models import MessageQueueConfig -from src.app.application.common.interfaces import MessageQueueGateway +from dma.infrastructure.config.models import MessageQueueConfig +from dma.application.common.interfaces import MessageQueueGateway from .iterables import batched diff --git a/src/app/infrastructure/message_queue/iterables.py b/src/dma/infrastructure/message_queue/iterables.py similarity index 100% rename from src/app/infrastructure/message_queue/iterables.py rename to src/dma/infrastructure/message_queue/iterables.py diff --git a/src/app/infrastructure/object_storage/__init__.py b/src/dma/infrastructure/object_storage/__init__.py similarity index 100% rename from src/app/infrastructure/object_storage/__init__.py rename to src/dma/infrastructure/object_storage/__init__.py diff --git a/src/app/infrastructure/object_storage/factory.py b/src/dma/infrastructure/object_storage/factory.py similarity index 100% rename from src/app/infrastructure/object_storage/factory.py rename to src/dma/infrastructure/object_storage/factory.py diff --git a/src/app/infrastructure/object_storage/gateway.py b/src/dma/infrastructure/object_storage/gateway.py similarity index 97% rename from src/app/infrastructure/object_storage/gateway.py rename to src/dma/infrastructure/object_storage/gateway.py index 1b3d18b..890d685 100644 --- a/src/app/infrastructure/object_storage/gateway.py +++ b/src/dma/infrastructure/object_storage/gateway.py @@ -4,7 +4,7 @@ from types_aiobotocore_s3.service_resource import Bucket, S3ServiceResource from types_aiobotocore_s3.client import S3Client -from src.app.infrastructure.base import AIOBotoGateway +from dma.infrastructure.base import AIOBotoGateway class ObjectStorageGatewayImpl(AIOBotoGateway): diff --git a/src/app/presentation/__init__.py b/src/dma/presentation/__init__.py similarity index 100% rename from src/app/presentation/__init__.py rename to src/dma/presentation/__init__.py diff --git a/src/app/presentation/api/__init__.py b/src/dma/presentation/api/__init__.py similarity index 100% rename from src/app/presentation/api/__init__.py rename to src/dma/presentation/api/__init__.py diff --git a/src/app/presentation/api/v1/__init__.py b/src/dma/presentation/api/v1/__init__.py similarity index 100% rename from src/app/presentation/api/v1/__init__.py rename to src/dma/presentation/api/v1/__init__.py diff --git a/src/app/presentation/api/v1/__main__.py b/src/dma/presentation/api/v1/__main__.py similarity index 71% rename from src/app/presentation/api/v1/__main__.py rename to src/dma/presentation/api/v1/__main__.py index 9bba973..61f447c 100644 --- a/src/app/presentation/api/v1/__main__.py +++ b/src/dma/presentation/api/v1/__main__.py @@ -3,11 +3,11 @@ import uvicorn from fastapi import FastAPI -from src.app.infrastructure.config.models import AppConfig, Config -from src.app.infrastructure.config.parsers.main import load_config -from src.app.infrastructure.log.main import configure_logging -from src.app.presentation.api.v1 import controllers, middlewares, providers -from src.app.presentation.api.v1.factory import create_fastapi_app +from dma.infrastructure.config.models import AppConfig, Config +from dma.infrastructure.config.parsers.main import load_config +from dma.infrastructure.log.main import configure_logging +from dma.presentation.api.v1 import controllers, middlewares, providers +from dma.presentation.api.v1.factory import create_fastapi_app logger = logging.getLogger(__name__) diff --git a/src/app/presentation/api/v1/controllers/__init__.py b/src/dma/presentation/api/v1/controllers/__init__.py similarity index 100% rename from src/app/presentation/api/v1/controllers/__init__.py rename to src/dma/presentation/api/v1/controllers/__init__.py diff --git a/src/app/presentation/api/v1/controllers/healthcheck.py b/src/dma/presentation/api/v1/controllers/healthcheck.py similarity index 100% rename from src/app/presentation/api/v1/controllers/healthcheck.py rename to src/dma/presentation/api/v1/controllers/healthcheck.py diff --git a/src/app/presentation/api/v1/controllers/main.py b/src/dma/presentation/api/v1/controllers/main.py similarity index 100% rename from src/app/presentation/api/v1/controllers/main.py rename to src/dma/presentation/api/v1/controllers/main.py diff --git a/src/app/presentation/api/v1/factory.py b/src/dma/presentation/api/v1/factory.py similarity index 100% rename from src/app/presentation/api/v1/factory.py rename to src/dma/presentation/api/v1/factory.py diff --git a/src/app/presentation/api/v1/middlewares/__init__.py b/src/dma/presentation/api/v1/middlewares/__init__.py similarity index 100% rename from src/app/presentation/api/v1/middlewares/__init__.py rename to src/dma/presentation/api/v1/middlewares/__init__.py diff --git a/src/app/presentation/api/v1/middlewares/main.py b/src/dma/presentation/api/v1/middlewares/main.py similarity index 100% rename from src/app/presentation/api/v1/middlewares/main.py rename to src/dma/presentation/api/v1/middlewares/main.py diff --git a/src/app/presentation/api/v1/providers/__init__.py b/src/dma/presentation/api/v1/providers/__init__.py similarity index 100% rename from src/app/presentation/api/v1/providers/__init__.py rename to src/dma/presentation/api/v1/providers/__init__.py diff --git a/src/app/presentation/api/v1/providers/main.py b/src/dma/presentation/api/v1/providers/main.py similarity index 100% rename from src/app/presentation/api/v1/providers/main.py rename to src/dma/presentation/api/v1/providers/main.py diff --git a/tests/integration/infrastructure/database/gateways/conftest.py b/tests/integration/infrastructure/database/gateways/conftest.py index f6012e1..ebd7238 100644 --- a/tests/integration/infrastructure/database/gateways/conftest.py +++ b/tests/integration/infrastructure/database/gateways/conftest.py @@ -1,7 +1,7 @@ import pytest -from src.app.application.problem.dto import ProblemCreate -from src.app.application.user.dto import UserCreate +from dma.application.problem.dto import ProblemCreate +from dma.application.user.dto import UserCreate @pytest.fixture() diff --git a/tests/integration/infrastructure/database/gateways/test_problem_gateway.py b/tests/integration/infrastructure/database/gateways/test_problem_gateway.py index 7a1e923..d623c69 100644 --- a/tests/integration/infrastructure/database/gateways/test_problem_gateway.py +++ b/tests/integration/infrastructure/database/gateways/test_problem_gateway.py @@ -5,19 +5,19 @@ from sqlalchemy.ext.asyncio import AsyncSession -from src.app.application.problem.filters import ProblemFilters -from src.app.application.common.pagination import LimitOffsetPagination, SortOrder -from src.app.application.problem.dto import ( +from dma.application.problem.filters import ProblemFilters +from dma.application.common.pagination import LimitOffsetPagination, SortOrder +from dma.application.problem.dto import ( Problem as ProblemDTO, Problems as ProblemsDTO, ProblemCreate as ProblemCreateDTO, ProblemUpdate as ProblemUpdateDTO, ) -from src.app.application.user.dto import ( +from dma.application.user.dto import ( UserCreate as UserCreateDTO, ) -from src.app.infrastructure.database.gateways.problem import ProblemGatewayImpl -from src.app.infrastructure.database.gateways.user import UserGatewayImpl +from dma.infrastructure.database.gateways.problem import ProblemGatewayImpl +from dma.infrastructure.database.gateways.user import UserGatewayImpl async def test_create_problem( diff --git a/tests/integration/infrastructure/database/gateways/test_user_gateway.py b/tests/integration/infrastructure/database/gateways/test_user_gateway.py index cd6d346..4da3f68 100644 --- a/tests/integration/infrastructure/database/gateways/test_user_gateway.py +++ b/tests/integration/infrastructure/database/gateways/test_user_gateway.py @@ -5,15 +5,15 @@ from sqlalchemy.ext.asyncio import AsyncSession -from src.app.application.user.filters import UserFilters -from src.app.application.common.pagination import LimitOffsetPagination, SortOrder -from src.app.application.user.dto import ( +from dma.application.user.filters import UserFilters +from dma.application.common.pagination import LimitOffsetPagination, SortOrder +from dma.application.user.dto import ( User as UserDTO, Users as UsersDTO, UserCreate as UserCreateDTO, UserUpdate as UserUpdateDTO, ) -from src.app.infrastructure.database.gateways.user import UserGatewayImpl +from dma.infrastructure.database.gateways.user import UserGatewayImpl async def test_create_user( diff --git a/tests/integration/infrastructure/database/test_stairway.py b/tests/integration/infrastructure/database/test_stairway.py index c1aab82..4f6ed59 100644 --- a/tests/integration/infrastructure/database/test_stairway.py +++ b/tests/integration/infrastructure/database/test_stairway.py @@ -7,7 +7,7 @@ def get_revisions(alembic_config: AlembicConfig) -> list[Script]: # Get directory object with Alembic migrations script_location = alembic_config.get_main_option( - "script_location", default="./src/app/infrastructure/database/migrations", + "script_location", default="./src/dma/infrastructure/database/migrations", ) revisions_dir = ScriptDirectory(script_location) diff --git a/tests/integration/infrastructure/message_queue/conftest.py b/tests/integration/infrastructure/message_queue/conftest.py index 98b66d2..74d60fd 100644 --- a/tests/integration/infrastructure/message_queue/conftest.py +++ b/tests/integration/infrastructure/message_queue/conftest.py @@ -6,8 +6,8 @@ import pytest import pytest_asyncio -from src.app.infrastructure.config.models import MessageQueueConfig -from src.app.infrastructure.message_queue.gateway import MessageQueueGatewayImpl +from dma.infrastructure.config.models import MessageQueueConfig +from dma.infrastructure.message_queue.gateway import MessageQueueGatewayImpl @pytest.fixture(scope="session") diff --git a/tests/integration/infrastructure/message_queue/test_gateway.py b/tests/integration/infrastructure/message_queue/test_gateway.py index 834f4b7..037dc9e 100644 --- a/tests/integration/infrastructure/message_queue/test_gateway.py +++ b/tests/integration/infrastructure/message_queue/test_gateway.py @@ -6,7 +6,7 @@ from aio_pika.abc import AbstractIncomingMessage from aiormq import ChannelNotFoundEntity -from src.app.infrastructure.message_queue.gateway import MessageQueueGatewayImpl +from dma.infrastructure.message_queue.gateway import MessageQueueGatewayImpl @pytest.mark.order(1) diff --git a/tests/integration/infrastructure/object_storage/conftest.py b/tests/integration/infrastructure/object_storage/conftest.py index f1b120b..e9077c8 100644 --- a/tests/integration/infrastructure/object_storage/conftest.py +++ b/tests/integration/infrastructure/object_storage/conftest.py @@ -8,7 +8,7 @@ import pytest_asyncio from testcontainers.minio import MinioContainer # type: ignore[import-untyped] -from src.app.infrastructure.object_storage.gateway import ObjectStorageGatewayImpl +from dma.infrastructure.object_storage.gateway import ObjectStorageGatewayImpl BUCKET_NAME: str = "bucket-name" diff --git a/tests/integration/infrastructure/object_storage/test_gateway.py b/tests/integration/infrastructure/object_storage/test_gateway.py index f1ebbe2..7e823bd 100644 --- a/tests/integration/infrastructure/object_storage/test_gateway.py +++ b/tests/integration/infrastructure/object_storage/test_gateway.py @@ -5,7 +5,7 @@ import pytest import pytest_asyncio -from src.app.infrastructure.object_storage.gateway import ObjectStorageGatewayImpl +from dma.infrastructure.object_storage.gateway import ObjectStorageGatewayImpl @pytest.mark.order("first")