summaryrefslogtreecommitdiff
path: root/shop.fnl
diff options
context:
space:
mode:
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?}