summaryrefslogtreecommitdiff
path: root/api.lisp
blob: 8159a1ccdc8eff68ba9e54015e970128641aeb29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;;;; api.lisp -- http routes for dnd

(in-package :dungeons-and-deadlines)

(lzb:provision-app (api)
  :title "Dungeons & Deadlines"
  :version "0.1.0"
  :prefix "/api"
  :content-type "application/json"
  :auth 'default-auth)

(defun default-auth (&rest ignore)
  (declare (ignore ignore))
  t)



(defendpoint* :get "/hall-of-legends" ((filter-by identity))
  (:auth t)
  "Get a list of heros sorted by renown"
  (json:to-json
   (list :heroes 
         (sort (copy-seq (db:store-objects-with-class 'hero))
               #'>
               :key #'renown))))