aboutsummaryrefslogtreecommitdiffhomepage
path: root/model.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-27 16:00:26 -0500
committerColin Okay <colin@cicadas.surf>2022-10-27 16:00:26 -0500
commit4384b353d9df4d9ab7b958b8081fccf3d9f5aacb (patch)
tree0818a9e5270dce92086c4e66d93ed045d4e9b92c /model.lisp
parentf94d232ffbbb40c67925313dbb8025286035ee06 (diff)
Add: user invite features
Diffstat (limited to 'model.lisp')
-rw-r--r--model.lisp14
1 files changed, 13 insertions, 1 deletions
diff --git a/model.lisp b/model.lisp
index 42142ed..a866088 100644
--- a/model.lisp
+++ b/model.lisp
@@ -2,6 +2,8 @@
(in-package :vampire)
+;;; CLASSES
+
(defclass/bknr keyed ()
((key :r :std (nuid)
:index-type string-unique-index
@@ -16,7 +18,9 @@
(pwhash :with)))
(defclass/bknr invite (keyed)
- ((maker :r :std nil)
+ ((maker :ri :std nil
+ :index-type hash-index
+ :index-reader invites-by-maker)
(uses-remaining :std nil)))
(defclass/bknr playlist (keyed)
@@ -106,6 +110,14 @@
(hash-string pw (user-pwsalt user)))
user))))
+(defun destroy-invite (invite)
+ (with-transaction ()
+ (bknr.datastore:delete-object invite)))
+
+(defun make-invite (user &optional uses)
+ (with-transaction ()
+ (make-instance 'invite :maker user :uses-remaining uses)))
+
(defun append-track (pl tr)
(with-transaction ()
(add-track tr pl)))