aboutsummaryrefslogtreecommitdiffhomepage
path: root/site/invites.lisp
diff options
context:
space:
mode:
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))))