diff options
author | Tom Willemse | 2013-07-07 23:46:15 +0200 |
---|---|---|
committer | Tom Willemse | 2013-07-07 23:46:15 +0200 |
commit | a322d9802ca0246c7977ced54952ef34d3fb2d16 (patch) | |
tree | 84f3627b33acf485f4864bf875f5844a4b1f2d1c /scrumli.lisp | |
parent | aece802c32b638f805a57496a89e8ab1edc6223c (diff) | |
download | scrumli-a322d9802ca0246c7977ced54952ef34d3fb2d16.tar.gz scrumli-a322d9802ca0246c7977ced54952ef34d3fb2d16.zip |
Respond to some more POSTs
Diffstat (limited to 'scrumli.lisp')
-rw-r--r-- | scrumli.lisp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/scrumli.lisp b/scrumli.lisp index 778b1aa..8ab60f7 100644 --- a/scrumli.lisp +++ b/scrumli.lisp @@ -115,32 +115,38 @@ 200) 403)) -(define-route stories-state ("stories/state" :method :post) +(define-route stories-state ("stories/state" :method :post + :content-type "text/json") (if (logged-in-p) (let* ((id (hunchentoot:post-parameter "id")) - (current-state (story-get-state 'story id))) - (story-set-state 'story id (ecase (intern current-state :scrumli) - (todo "DOING") - (doing "DONE") - (done "TODO"))) - 200) + (current-state (story-get-state 'story id)) + (next (ecase (intern current-state :scrumli) + (todo "DOING") + (doing "DONE") + (done "TODO")))) + (story-set-state 'story id next) + (encode-json-to-string `((status . "ok") (state . ,next)))) 403)) (define-route task-state ("tasks/state" :method :post) (if (logged-in-p) (let* ((id (hunchentoot:post-parameter "id")) - (current-state (story-get-state 'task id))) - (story-set-state 'task id (ecase (intern current-state :scrumli) - (todo "DOING") - (doing "DONE") - (done "TODO")))))) + (current-state (story-get-state 'task id)) + (next (ecase (intern current-state :scrumli) + (todo "DOING") + (doing "DONE") + (done "TODO")))) + (story-set-state 'task id next) + (encode-json-to-string `((status . "ok") (state . ,next)))) + 403)) -(define-route stories-priority ("stories/:dir" :method :post) +(define-route stories-priority ("stories/:dir" :method :post + :content-type "text/json") (if (logged-in-p) (let* ((id (hunchentoot:post-parameter "id"))) (story-change-priority 'story id (intern (string-upcase dir) :keyword)) - 200) + (encode-json-to-string '((status . "ok")))) 403)) (define-route task-priority ("tasks/:dir" :method :post) |