Skip to content

Instantly share code, notes, and snippets.

@bradcypert
Created May 28, 2017 18:00
Show Gist options
  • Save bradcypert/1746b224c1d245ab97ec25574c44f0f0 to your computer and use it in GitHub Desktop.
Save bradcypert/1746b224c1d245ab97ec25574c44f0f0 to your computer and use it in GitHub Desktop.
(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