We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd3501d commit 43c2df7Copy full SHA for 43c2df7
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