From 187fce76197031dba1112bd6023b41166f039f3e Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 6 Mar 2023 19:44:53 -0800 Subject: Add: adventure creation --- src/endpoints.lisp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/endpoints.lisp') 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))))))) + -- cgit v1.2.3