Skip to content

Commit bb63a94

Browse files
committed
Inject send_email & publish
1 parent ebdee37 commit bb63a94

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/allocation/service_layer/handlers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from dataclasses import asdict
2+
from typing import Callable
23

3-
from allocation.adapters import email, event_publisher
44
from allocation.domain import commands, events, model
55
from allocation.service_layer import unit_of_work
66

@@ -76,15 +76,15 @@ def deallocate(
7676

7777

7878
def publish_allocated_event(
79-
message: events.Allocated, uow: unit_of_work.AbstractUnitOfWork
80-
):
81-
event_publisher.publish("line_allocated", message)
79+
message: events.Allocated, publish: Callable
80+
) -> None:
81+
publish("line_allocated", message)
8282

8383

8484
def send_out_of_stock_notification(
85-
message: events.OutOfStock, uow: unit_of_work.AbstractUnitOfWork
86-
):
87-
email.send_mail("stock-admin@made.com", f"Out of stock: {message.sku}")
85+
message: events.OutOfStock, send_mail: Callable
86+
) -> None:
87+
send_mail("stock-admin@made.com", f"Out of stock: {message.sku}")
8888

8989

9090
def add_allocation_to_read_model(

0 commit comments

Comments
 (0)