-
-
Save mikos/071f542d1d9085cb6536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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