summaryrefslogtreecommitdiff
path: root/vampire.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-27 06:57:19 -0500
committerColin Okay <colin@cicadas.surf>2022-10-27 06:57:19 -0500
commitf0eff7d9c69de2e6c7257b8d94e7deb7b89becdf (patch)
tree283dabb89380e6c976038ff701afec0a79b297ba /vampire.lisp
parent05d38ae1fba94569e1fd4f53ca3ad33c5af6e016 (diff)
Add+Move: user and model files, moved code into files
Diffstat (limited to 'vampire.lisp')
-rw-r--r--vampire.lisp34
1 files changed, 8 insertions, 26 deletions
diff --git a/vampire.lisp b/vampire.lisp
index cf6accc..85eed95 100644
--- a/vampire.lisp
+++ b/vampire.lisp
@@ -19,29 +19,21 @@
;;; RESOURCE MODEL
-(defclass/bknr user (keyed)
- ((name :with :std "")
- (playlists :with :std (list))
- (pw pwhash :with)))
+
;;; TRANSACTIONS
-(defun new-user (&key name)
- (with-transaction ()
- (make-instance 'user :name name)))
+
;;; CLIENT
-(defparameter +user-key+ "vampire.userkey")
-(defun user-key (window)
- (jonathan:parse (storage-element window :local +user-key+)))
-(defun (setf user-key) (val window)
- (setf (storage-element window :local +user-key+) (jonathan:to-json val)))
-(defun session-user (clog-obj)
- (object-with-key (user-key (window (connection-body clog-obj)))))
+
+
+
+
(defun create-new-playlist-form (parent &rest args)
(declare (ignorable args))
@@ -78,16 +70,6 @@
(setf (url (location (connection-body parent)))
url)))))))
-
-(defun user-page (body)
- (if-let (user (session-user body))
- (with-clog-create body
- (div ()
- (p (:content (format nil "Welcome ~a" (user-name user))))
- (new-playlist-form ())
- (playlist-listing ())))
- (setf (url (location body)) "/")))
-
(defun login-page (body)
(with-clog-create body
(div ()
@@ -104,7 +86,7 @@
(defun main (body)
(if (session-user body)
- (setf (url (location body)) "/user")
+ (setf (url (location body)) "/home")
(setf (url (location body)) "/login")))
;;; STARTUP
@@ -123,7 +105,7 @@
(initialize 'main
:extended-routing t
:static-root (static-directory config))
- (set-on-new-window 'user-page :path "/user")
+ (set-on-new-window 'user-home-page :path "/home")
(set-on-new-window 'login-page :path "/login")
(set-on-new-window 'playlist-page :path "/playlist")
(open-browser))