summaryrefslogtreecommitdiff
path: root/site/invites.lisp
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2024-06-19 12:01:29 -0500
committerGrant Shangreaux <grant@unabridgedsoftware.com>2024-06-19 12:01:29 -0500
commit5a586d369c823a040989283a3650444a2b0c0913 (patch)
treea617035409c3c076c10bcd1449cf5ad70ef8127a /site/invites.lisp
parent132bb57d594894f7c9bdfea23e17971028acaedf (diff)
[87] Add: invite creation, listing, and deletion when used up
Diffstat (limited to 'site/invites.lisp')
-rw-r--r--site/invites.lisp14
1 files changed, 14 insertions, 0 deletions
diff --git a/site/invites.lisp b/site/invites.lisp
new file mode 100644
index 0000000..b463a4d
--- /dev/null
+++ b/site/invites.lisp
@@ -0,0 +1,14 @@
+(in-package #:vampire)
+
+(wknd:defendpoint invites
+ :using user-known
+ :post :to "invites"
+ :handle
+ (progn
+ (db:with-transaction ()
+ (make-instance 'invite :maker user :uses-remaining 1))
+ (wknd:endpoint-redirect 'home.html)))
+
+(defun invite-validp (invite)
+ (let ((uses (uses-remaining invite)))
+ (or (< 0 uses) (null uses))))