diff options
author | Colin Okay <colin@cicadas.surf> | 2022-10-27 15:10:28 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-10-27 15:10:28 -0500 |
commit | f0586d83687271525f8d6f0874dbb924ecb7f7c2 (patch) | |
tree | f986423c0e272f0c51a9bf234002fa9c93776704 /model.lisp | |
parent | f80c82597ffcf3a65cc49ffca8f3b7ffa8117c27 (diff) |
Add: explore page; editor privilege views
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) |