diff options
Diffstat (limited to 'model.lisp')
-rw-r--r-- | model.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -36,6 +36,10 @@ ;;; MODEL OPERATIONS +(defun can-edit-p (user playlist) + (or (eq (playlist-user playlist) user) + (member user (playlist-editors playlist) :test #'eq))) + (defun invite-by-code (code) "Returns NIL if CODE is an invalid invite code. Returns the INVITE instance otherwise" @@ -56,6 +60,14 @@ (when (equalp pwhash (hash-string password pwsalt)) user)))) +(defun last-change (obj) + (slot-value obj 'bknr.datastore::last-change)) + +(defun recent-playlists (&optional (count 10)) + (take count + (sort (copy-seq (store-objects-with-class 'playlist)) + #'> + :key #'last-change))) (defun playlist-duration (pl) (reduce #'+ (playlist-tracks pl) |