Skip to content

Commit 95cb05a

Browse files
committed
handlers now have all and only explicit dependencies [handler_with_explicit_dependency]
1 parent cd042a2 commit 95cb05a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/allocation/service_layer/handlers.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# pylint: disable=unused-argument
22
from __future__ import annotations
33
from dataclasses import asdict
4-
from typing import TYPE_CHECKING
5-
from allocation.adapters import email, redis_eventpublisher
4+
from typing import Callable, TYPE_CHECKING
65
from allocation.domain import commands, events, model
76
from allocation.domain.model import OrderLine
87

@@ -65,19 +64,19 @@ def change_batch_quantity(
6564

6665
def send_out_of_stock_notification(
6766
event: events.OutOfStock,
68-
uow: unit_of_work.AbstractUnitOfWork,
67+
send_mail: Callable,
6968
):
70-
email.send(
69+
send_mail(
7170
7271
f"Out of stock for {event.sku}",
7372
)
7473

7574

7675
def publish_allocated_event(
7776
event: events.Allocated,
78-
uow: unit_of_work.AbstractUnitOfWork,
77+
publish: Callable,
7978
):
80-
redis_eventpublisher.publish("line_allocated", event)
79+
publish("line_allocated", event)
8180

8281

8382
def add_allocation_to_read_model(

0 commit comments

Comments
 (0)