diff options
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) |