From 5cf21fcb8c91896bb2b889dd4a90cc0b2ef3e9e5 Mon Sep 17 00:00:00 2001 From: unwox Date: Mon, 13 Oct 2025 21:04:15 +0600 Subject: finishing touches for shop functionality --- shop.fnl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'shop.fnl') diff --git a/shop.fnl b/shop.fnl index fea398e..9711095 100644 --- a/shop.fnl +++ b/shop.fnl @@ -111,6 +111,19 @@ ORDER BY order_lines.creation_time ASC" [order-id]))) +(fn in-basket? [db order-id product-name] + (= 1 + (# + (_G.must + (luna.db.query + db + "SELECT id + FROM order_lines + WHERE order_lines.order_id = ? + AND order_lines.product_name = ? + LIMIT 1" + [order-id product-name]))))) + {: create-order : place-order : finish-order @@ -118,4 +131,5 @@ : order-id : create-order-line : delete-order-line - : basket} + : basket + : in-basket?} -- cgit v1.2.3