Skip to content

Commit 1198e57

Browse files
author
Sergio García Prado
authored
Merge pull request #281 from Clariteia/issue-280-update-minos-common
#280 - update minos common
2 parents 139156a + 5fbbacb commit 1198e57

35 files changed

+208
-326
lines changed

microservices/authentication/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ saga:
5757
storage:
5858
path: "./auth.lmdb"
5959
discovery:
60+
client: minos.networks.MinosDiscoveryClient
6061
host: localhost
6162
port: 5567

microservices/authentication/poetry.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

microservices/authentication/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ packages = [{ include = "src" }]
77

88
[tool.poetry.dependencies]
99
python = "^3.9"
10-
minos-microservice-common = "^0.1.12"
11-
minos-microservice-networks = ">=0.0.15<0.1"
10+
minos-microservice-common = "^0.1.13"
11+
minos-microservice-networks = ">=0.0.16<0.1"
1212
minos-microservice-saga = ">=0.0.11<0.1"
13-
minos-microservice-cqrs = ">=0.0.2<0.1"
13+
minos-microservice-cqrs = ">=0.0.3<0.1"
1414
typer = "^0.3.2"
1515
PyJWT = "^2.1.0"
1616
SQLAlchemy = "1.4.22"

microservices/cart/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ saga:
5757
storage:
5858
path: "./cart.lmdb"
5959
discovery:
60+
client: minos.networks.MinosDiscoveryClient
6061
host: localhost
6162
port: 5567

microservices/cart/poetry.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

microservices/cart/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ packages = [{ include = "src" }]
88
[tool.poetry.dependencies]
99
python = "^3.9"
1010
typer = "^0.3.2"
11-
minos-microservice-common = "^0.1.12"
12-
minos-microservice-networks = ">=0.0.15<0.1"
11+
minos-microservice-common = "^0.1.13"
12+
minos-microservice-networks = ">=0.0.16<0.1"
1313
minos-microservice-saga = ">=0.0.11<0.1"
14-
minos-microservice-cqrs = ">=0.0.2<0.1"
14+
minos-microservice-cqrs = ">=0.0.3<0.1"
1515
SQLAlchemy = "1.4.22"
1616

1717
[tool.poetry.dev-dependencies]

microservices/cart/src/commands/sagas/add_cart_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async def _create_cart_item(context: SagaContext) -> SagaContext:
2424
cart_id = context["cart_id"]
2525
product_uuid = context["product_uuid"]
2626
quantity = context["quantity"]
27-
cart = await Cart.get_one(cart_id)
27+
cart = await Cart.get(cart_id)
2828
cart_item = CartEntry(product=product_uuid, quantity=quantity)
2929
cart.entries.add(cart_item)
3030
await cart.save()

microservices/cart/src/commands/sagas/remove_cart_item.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def _reserve_products(context: SagaContext) -> Model:
2828
product_uuids = [context["product_uuid"]]
2929
cart_id = context["cart_id"]
3030
quantities = defaultdict(int)
31-
cart = await Cart.get_one(cart_id)
31+
cart = await Cart.get(cart_id)
3232
for product_id in product_uuids:
3333
quantities[str(product_id)] += get_product_quantity(cart, product_id)
3434

@@ -39,7 +39,7 @@ async def _release_products(context: SagaContext) -> Model:
3939
product_uuids = [context["product_uuid"]]
4040
cart_id = context["cart_id"]
4141
quantities = defaultdict(int)
42-
cart = await Cart.get_one(cart_id)
42+
cart = await Cart.get(cart_id)
4343
for product_id in product_uuids:
4444
quantities[str(product_id)] -= get_product_quantity(cart, product_id)
4545

@@ -49,7 +49,7 @@ async def _release_products(context: SagaContext) -> Model:
4949
async def _remove_cart_item(context: SagaContext) -> SagaContext:
5050
cart_id = context["cart_id"]
5151
product = context["product"]
52-
cart = await Cart.get_one(cart_id)
52+
cart = await Cart.get(cart_id)
5353
cart.entries.discard(product)
5454

5555
await cart.save()

microservices/cart/src/commands/sagas/update_cart_item.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def _release_or_reserve_products(context: SagaContext) -> Model:
3131
quantity = context["quantity"]
3232

3333
for product_id in product_uuids:
34-
prev = await Cart.get_one(cart_id)
34+
prev = await Cart.get(cart_id)
3535

3636
prev_quantity = 0
3737
for key, value in prev.entries.data.items():
@@ -58,7 +58,7 @@ async def _compensation(context: SagaContext) -> Model:
5858
quantity = context["quantity"]
5959

6060
for product_id in product_uuids:
61-
prev = await Cart.get_one(cart_id)
61+
prev = await Cart.get(cart_id)
6262

6363
prev_quantity = 0
6464
for key, value in prev.entries.data.items():
@@ -82,7 +82,7 @@ async def _update_cart_item(context: SagaContext) -> SagaContext:
8282
cart_id = context["cart_id"]
8383
product_uuid = context["product_uuid"]
8484
quantity = context["quantity"]
85-
cart = await Cart.get_one(cart_id)
85+
cart = await Cart.get(cart_id)
8686

8787
for key, value in cart.entries.data.items():
8888
if str(value.product) == product_uuid:

microservices/cart/src/commands/services.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ async def delete_cart(self, request: Request) -> Response:
112112
content = await request.content()
113113

114114
cart_id = content["uuid"]
115-
cart = await Cart.get_one(cart_id)
115+
cart = await Cart.get(cart_id)
116116

117117
saga_execution = await self.saga_manager.run(DELETE_CART, context=SagaContext(cart=cart))
118118

119119
return Response(saga_execution.uuid)
120120

121121
@staticmethod
122122
async def _get_cart_item(cart_id: UUID, product_uuid: UUID):
123-
cart = await Cart.get_one(cart_id)
123+
cart = await Cart.get(cart_id)
124124
for idx, product in enumerate(cart.entries):
125125
if str(product.product) == product_uuid:
126126
return idx, product

0 commit comments

Comments
 (0)