We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eefded6 commit d746728Copy full SHA for d746728
src/allocation/service_layer/handlers.py
@@ -61,3 +61,15 @@ def publish_allocated_event(
61
event: events.Allocated, uow: unit_of_work.AbstractUnitOfWork,
62
):
63
redis_eventpublisher.publish('line_allocated', event)
64
+
65
66
+def add_allocation_to_read_model(
67
+ event: events.Allocated, uow: unit_of_work.SqlAlchemyUnitOfWork,
68
+):
69
+ with uow:
70
+ uow.session.execute(
71
+ 'INSERT INTO allocations_view (orderid, sku, batchref)'
72
+ ' VALUES (:orderid, :sku, :batchref)',
73
+ dict(orderid=event.orderid, sku=event.sku, batchref=event.batchref)
74
+ )
75
+ uow.commit()
0 commit comments