summaryrefslogtreecommitdiff
path: root/shop.fnl
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-10-13 21:04:15 +0600
committerunwox <me@unwox.com>2025-10-13 23:11:20 +0600
commit5cf21fcb8c91896bb2b889dd4a90cc0b2ef3e9e5 (patch)
tree05826ed8beb78c736c94158ebe37d67063e38438 /shop.fnl
parenta7c25a5513e32669978b8e07fc9c61bd15cbdb02 (diff)
finishing touches for shop functionality
Diffstat (limited to 'shop.fnl')
-rw-r--r--shop.fnl16
1 files changed, 15 insertions, 1 deletions
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?}