-
-
Save hendore/2d8686fddcec2342688372b300d811e6 to your computer and use it in GitHub Desktop.
Clojure account registration
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
(declare insert-account! send-welcome-email!) | |
(defn register-account! | |
[account-info] | |
(when-let [account (insert-account! account-info)] | |
(send-welcome-email! account))) | |
(defn- insert-account! | |
[account-info] | |
(let [account (select-keys account-info [:name :email :phone :password])] | |
(jdbc/insert! pgsql-config :accounts account {:result-set-fn first}))) | |
(defn- send-welcome-email! | |
[{:keys [email]}] | |
(str "Sending welcome email to " email)) | |
(defn registration-req-handler | |
[request] | |
(register-account! (request :body))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment