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