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 1d100f0 commit cb78b82Copy full SHA for cb78b82
src/allocation/views.py
@@ -0,0 +1,13 @@
1
+from allocation.service_layer import unit_of_work
2
+
3
+def allocations(orderid: str, uow: unit_of_work.SqlAlchemyUnitOfWork):
4
+ with uow:
5
+ results = list(uow.session.execute(
6
+ 'SELECT ol.sku, b.reference'
7
+ ' FROM allocations AS a'
8
+ ' JOIN batches AS b ON a.batch_id = b.id'
9
+ ' JOIN order_lines AS ol ON a.orderline_id = ol.id'
10
+ ' WHERE ol.orderid = :orderid',
11
+ dict(orderid=orderid)
12
+ ))
13
+ return [{'sku': sku, 'batchref': batchref} for sku, batchref in results]
0 commit comments