Skip to content

Instantly share code, notes, and snippets.

@mikos
Created March 24, 2016 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikos/071f542d1d9085cb6536 to your computer and use it in GitHub Desktop.
Save mikos/071f542d1d9085cb6536 to your computer and use it in GitHub Desktop.
(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