Skip to content

Instantly share code, notes, and snippets.

@mikos

mikos/scratch.clj Secret

Created Mar 24, 2016
Embed
What would you like to do?
(defn exists? [result]
(if result
result
(ring.util.http-response/not-found!)))
(defmethod compojure.api.meta/restructure-param :exists? [_ v acc]
(update-in acc [:lets] into ['_entry `(exists? (~v (~get-in ~'+compojure-api-request+ [:params :id])))]))
(GET "/:id" []
:path-params [id :- String]
:return (s/maybe Job)
:exists? (fn [id] (find-by-id db org-db id))
(ok _entry))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment