Skip to content

Commit 8b926e0

Browse files
committed
Refactor project structure
1 parent ddd0483 commit 8b926e0

43 files changed

Lines changed: 94 additions & 82 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 4 deletions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ ignore = [
134134
#
135135
"src/app/domain/value_objects/base.py" = ["B024", ] # abstract-base-class-without-abstract-method
136136
"src/app/infrastructure/adapters/password_hasher_bcrypt.py" = ["E501"] # line-too-long
137-
"src/app/infrastructure/constants.py" = ["S105"] # hardcoded-password-string
137+
"src/app/infrastructure/auth/session/constants.py" = ["S105"] # hardcoded-password-string
138138
"src/app/presentation/http/auth/constants.py" = ["S105"] # hardcoded-password-string
139139
"src/app/presentation/http/exceptions/handlers.py" = ["RUF029", ] # unused-async
140140
"scripts/dishka/plot_dependencies_data.py" = ["T201", ] # print

src/app/application/common/services/authorization/authorize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from app.application.common.constants import AUTHZ_NOT_AUTHORIZED
21
from app.application.common.exceptions.authorization import AuthorizationError
32
from app.application.common.services.authorization.base import (
43
Permission,
54
PermissionContext,
65
)
6+
from app.application.common.services.constants import AUTHZ_NOT_AUTHORIZED
77

88

99
def authorize[PC: PermissionContext](
File renamed without changes.

src/app/application/common/services/current_user.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import logging
22

3-
from app.application.common.constants import AUTHZ_NO_CURRENT_USER, AUTHZ_NOT_AUTHORIZED
43
from app.application.common.exceptions.authorization import AuthorizationError
54
from app.application.common.ports.access_revoker import AccessRevoker
65
from app.application.common.ports.identity_provider import IdentityProvider
76
from app.application.common.ports.user_command_gateway import UserCommandGateway
7+
from app.application.common.services.constants import (
8+
AUTHZ_NO_CURRENT_USER,
9+
AUTHZ_NOT_AUTHORIZED,
10+
)
811
from app.domain.entities.user import User
912

1013
log = logging.getLogger(__name__)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from typing import Final
2+
3+
DB_CONSTRAINT_VIOLATION: Final[str] = "Database constraint violation."
4+
DB_COMMIT_DONE: Final[str] = "Commit was done."
5+
DB_COMMIT_FAILED: Final[str] = "Commit failed."
6+
DB_FLUSH_DONE: Final[str] = "Flush was done."
7+
DB_FLUSH_FAILED: Final[str] = "Flush failed."
8+
DB_QUERY_FAILED: Final[str] = "Database query failed."

src/app/infrastructure/adapters/main_transaction_manager_sqla.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
TransactionManager,
99
)
1010
from app.domain.exceptions.user import UsernameAlreadyExistsError
11-
from app.infrastructure.adapters.types import MainAsyncSession
12-
from app.infrastructure.constants import (
11+
from app.infrastructure.adapters.constants import (
1312
DB_COMMIT_DONE,
1413
DB_COMMIT_FAILED,
1514
DB_CONSTRAINT_VIOLATION,
1615
DB_FLUSH_DONE,
1716
DB_FLUSH_FAILED,
1817
DB_QUERY_FAILED,
1918
)
19+
from app.infrastructure.adapters.types import MainAsyncSession
2020
from app.infrastructure.exceptions.gateway import DataMapperError
2121

2222
log = logging.getLogger(__name__)

src/app/infrastructure/adapters/user_data_mapper_sqla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from app.domain.entities.user import User
66
from app.domain.value_objects.user_id import UserId
77
from app.domain.value_objects.username.username import Username
8+
from app.infrastructure.adapters.constants import DB_QUERY_FAILED
89
from app.infrastructure.adapters.types import MainAsyncSession
9-
from app.infrastructure.constants import DB_QUERY_FAILED
1010
from app.infrastructure.exceptions.gateway import DataMapperError
1111

1212

src/app/infrastructure/adapters/user_reader_sqla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from app.application.common.query_params.sorting import SortingOrder
1111
from app.application.common.query_params.user import UserListParams
1212
from app.domain.enums.user_role import UserRole
13+
from app.infrastructure.adapters.constants import DB_QUERY_FAILED
1314
from app.infrastructure.adapters.types import MainAsyncSession
14-
from app.infrastructure.constants import DB_QUERY_FAILED
1515
from app.infrastructure.exceptions.gateway import ReaderError
1616
from app.infrastructure.persistence_sqla.mappings.user import users_table
1717

File renamed without changes.

0 commit comments

Comments
 (0)