-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace seedwork Application with lato Application
- Loading branch information
Showing
54 changed files
with
1,527 additions
and
671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.10.0 | ||
3.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,7 @@ authors = ["Przemysław Górecki <[email protected]>"] | |
|
||
[tool.poetry.dependencies] | ||
python = "^3.10.0" | ||
pytest = "^6.2.4" | ||
pydantic = "^1.8.2" | ||
black = "^21.5b1" | ||
fastapi = "^0.95.2" | ||
uvicorn = "^0.14.0" | ||
starlette-context = "^0.3.3" | ||
SQLAlchemy = "^1.4.22" | ||
|
@@ -29,6 +26,9 @@ httpx = "^0.23.1" | |
requests = "^2.28.1" | ||
bcrypt = "^4.0.1" | ||
mypy = "^1.4.1" | ||
fastapi = "^0.110.0" | ||
lato = "^0.10.0" | ||
pydantic-settings = "^2.2.1" | ||
|
||
[tool.poetry.dev-dependencies] | ||
poethepoet = "^0.10.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
from api.dependencies import oauth2_scheme # noqa | ||
from api.routers import bidding, catalog, diagnostics, iam | ||
from config.api_config import ApiConfig | ||
from config.container import TopLevelContainer | ||
from config.container import create_application, ApplicationContainer | ||
from seedwork.domain.exceptions import DomainException, EntityNotFoundException | ||
from seedwork.infrastructure.database import Base | ||
from seedwork.infrastructure.logging import LoggerFactory, logger | ||
|
@@ -15,29 +15,30 @@ | |
LoggerFactory.configure(logger_name="api") | ||
|
||
# dependency injection container | ||
container = TopLevelContainer() | ||
container.config.from_pydantic(ApiConfig()) | ||
config = ApiConfig() | ||
container = ApplicationContainer(config=config) | ||
db_engine = container.db_engine() | ||
logger.info(f"using db engine {db_engine}, creating tables") | ||
Base.metadata.create_all(db_engine) | ||
logger.info("setup complete") | ||
|
||
app = FastAPI(debug=container.config.DEBUG) | ||
app = FastAPI(debug=config.DEBUG) | ||
|
||
app.include_router(catalog.router) | ||
app.include_router(bidding.router) | ||
app.include_router(iam.router) | ||
app.include_router(diagnostics.router) | ||
app.container = container | ||
|
||
db_engine = container.db_engine() | ||
logger.info(f"using db engine {db_engine}, creating tables") | ||
Base.metadata.create_all(db_engine) | ||
logger.info("setup complete") | ||
|
||
|
||
try: | ||
import uuid | ||
|
||
from modules.iam.application.services import IamService | ||
|
||
with app.container.application().transaction_context() as ctx: | ||
iam_service = ctx.get_service(IamService) | ||
iam_service = ctx[IamService] | ||
iam_service.create_user( | ||
user_id=uuid.UUID(int=1), | ||
email="[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
def test_login_with_api_token(app, api_client): | ||
# arrange | ||
with app.transaction_context() as ctx: | ||
iam_service = ctx.get_service(IamService) | ||
iam_service = ctx[IamService] | ||
iam_service.create_user( | ||
user_id=GenericUUID(int=1), | ||
email="[email protected]", | ||
|
@@ -31,7 +31,7 @@ def test_login_with_api_token(app, api_client): | |
def test_login_with_invalid_username_returns_400(app, api_client): | ||
# arrange | ||
with app.transaction_context() as ctx: | ||
iam_service = ctx.get_service(IamService) | ||
iam_service = ctx[IamService] | ||
iam_service.create_user( | ||
user_id=GenericUUID(int=1), | ||
email="[email protected]", | ||
|
@@ -53,7 +53,7 @@ def test_login_with_invalid_username_returns_400(app, api_client): | |
def test_login_with_invalid_password_returns_400(app, api_client): | ||
# arrange | ||
with app.transaction_context() as ctx: | ||
iam_service = ctx.get_service(IamService) | ||
iam_service = ctx[IamService] | ||
iam_service.create_user( | ||
user_id=GenericUUID(int=1), | ||
email="[email protected]", | ||
|
Oops, something went wrong.