Created
May 28, 2017 18:00
-
-
Save bradcypert/1746b224c1d245ab97ec25574c44f0f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(spec/def ::auth-user int?) | |
(spec/def ::id string?) | |
(spec/def ::rating string?) | |
(spec/def ::rate-podcast-spec (spec/keys :req-un [::auth-user ::id ::rating])) | |
(defn- rate-podcast | |
[params] | |
(if (spec/valid? ::rate-podcast-spec params) | |
(let [user (:auth-user params) | |
podcast (Integer/parseInt (:id params)) | |
rating (:rating params)] | |
(podcasts/rate-podcast {:user-id user | |
:podcast-id podcast | |
:rating rating}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment