diff options
author | Colin Okay <colin@cicadas.surf> | 2022-10-27 16:00:26 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-10-27 16:00:26 -0500 |
commit | 4384b353d9df4d9ab7b958b8081fccf3d9f5aacb (patch) | |
tree | 0818a9e5270dce92086c4e66d93ed045d4e9b92c /model.lisp | |
parent | f94d232ffbbb40c67925313dbb8025286035ee06 (diff) |
Add: user invite features
Diffstat (limited to 'model.lisp')
-rw-r--r-- | model.lisp | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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))) |