Browse Source

Moved the last of the business logic to the right layer

master
Stephen Starkey 2 years ago
parent
commit
f78d757b57
  1. 6
      src/clj/email_counter/emails.clj
  2. 2
      src/clj/email_counter/routes/services.clj

6
src/clj/email_counter/emails.clj

@ -30,3 +30,9 @@
(remove nil?)
(map str/lower-case)
(into #{})))
(defn count-unique
"Given a bunch of email addresses, count the number of unique ones, given
Gmail's special parsing rules."
[emails]
(count (unique-gmail-parsed-emails emails)))

2
src/clj/email_counter/routes/services.clj

@ -18,7 +18,7 @@
(def EmailAddress (s/constrained s/Str emails/parse-for-gmail 'EmailAddress))
(defn count-emails [{{{:keys [emails]} :body} :parameters}]
(ok {:total (count (emails/unique-gmail-parsed-emails emails))}))
(ok {:total (emails/count-unique emails)}))
(defn service-routes []
["/api"

Loading…
Cancel
Save