We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0866c72 commit f63f7a5Copy full SHA for f63f7a5
src/allocation/views.py
@@ -0,0 +1,16 @@
1
+from allocation.service_layer import unit_of_work
2
+
3
4
+def allocations(orderid: str, uow: unit_of_work.SqlAlchemyUnitOfWork):
5
+ with uow:
6
+ results = uow.session.execute(
7
+ """
8
+ SELECT ol.sku, b.reference
9
+ FROM allocations AS a
10
+ JOIN batches AS b ON a.batch_id = b.id
11
+ JOIN order_lines AS ol ON a.orderline_id = ol.id
12
+ WHERE ol.orderid = :orderid
13
+ """,
14
+ dict(orderid=orderid),
15
+ )
16
+ return [{"sku": sku, "batchref": batchref} for sku, batchref in results]
0 commit comments