Skip to content

Commit

Permalink
Merge pull request #51 from minos-framework/0.1.3
Browse files Browse the repository at this point in the history
v0.1.3
  • Loading branch information
Sergio García Prado authored Mar 18, 2022
2 parents f6edc79 + f499daf commit 62c8395
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions microservice/language/python/init/config.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ repository:
port: 5432
query_repository:
database: {{ name }}_query_db
user: postgres
password: ""
user: minos
password: min0s
host: localhost
port: 5432
snapshot:
Expand Down
4 changes: 2 additions & 2 deletions microservice/language/python/init/src/aggregates.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ class {{ aggregate }}Aggregate(Aggregate[{{ aggregate }}]):
@staticmethod
async def create() -> UUID:
"""Create a new instance."""
root = await {{ aggregate }}.create()
return root.uuid
{{ name }} = await {{ aggregate }}.create()
return {{ name }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class {{ aggregate }}CommandService(CommandService):
:return: A ``Response`` instance.
"""
try:
uuid = await {{ aggregate }}Aggregate.create()
return Response({"uuid": uuid})
{{ name }} = await {{ aggregate }}Aggregate.create()
return Response({{ name }})
except Exception as exc:
raise ResponseException(f"An error occurred during {{ aggregate }} creation: {exc}")
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ from .services import (

from .repository import (
{{ aggregate }}QueryServiceRepository,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from src.queries.models import Base
class {{ aggregate }}QueryServiceRepository(MinosSetup):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.engine = create_engine("postgresql+psycopg2://postgres:@localhost:5432/{{ name }}_query_db".format(**kwargs))
self.engine = create_engine("postgresql+psycopg2://minos:min0s@postgres:5432/{{ name }}_query_db".format(**kwargs))
self.session = sessionmaker(bind=self.engine)()

async def _setup(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from dependency_injector.wiring import (
Provide,
)

from src.queries.repository import (
{{ aggregate }}QueryServiceRepository,
)

from minos.aggregate import (
Event,
)
Expand Down

0 comments on commit 62c8395

Please sign in to comment.