summaryrefslogtreecommitdiff
path: root/src/endpoints.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-03-06 19:44:53 -0800
committercolin <colin@cicadas.surf>2023-03-06 19:44:53 -0800
commit187fce76197031dba1112bd6023b41166f039f3e (patch)
tree673514a59d4225b7773c6fc0edcd1e31a406de08 /src/endpoints.lisp
parent36df81a7e3bb23d4cc347cc335fbd9b949a6af91 (diff)
Add: adventure creation
Diffstat (limited to 'src/endpoints.lisp')
-rw-r--r--src/endpoints.lisp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/endpoints.lisp b/src/endpoints.lisp
index 5b65ff7..288f39e 100644
--- a/src/endpoints.lisp
+++ b/src/endpoints.lisp
@@ -133,12 +133,20 @@ functions in url parameters in endpoint definitions."
(defendpoint* :get "/adventure-awaits" () ()
(with-session (player)
(render (page-render-mode)
- (make-instance 'new-adventure))))
+ (make-instance 'adventure-awaits
+ :possible-seers (remove player (all-players))))))
(defendpoint* :post "/adventure-awaits" () ()
(with-session (creator)
- (with-checked-plist ((title :title 'a-short-string)) (lzb:request-body)
- (let ((adventure
- (create-adventure creator title)))
- (redirect-to (urlpath adventure))))))
+ (with-plist ((title :title) (description :description)) (lzb:request-body)
+ (let ((possible-seers
+ (loop :for (key val) :on (lzb:request-body) :by #'cddr
+ :when (string-equal key "POSSIBLE-SEER")
+ :collect (object-with-uid val))))
+ (redirect-to
+ (urlpath
+ (create-adventure creator title
+ :description description
+ :seers possible-seers)))))))
+