             [cljs.core.async :as async :refer [<! put! chan onto-chan close!]]
             [cljs-time.core :as time]
             [cljs-time.coerce :as ctime]
+            [cljs-time.format :as ftime]
             [common.util :refer [js-log log js->cljs]]
             [server.config :refer [config]]))
 

    (conj acc out-ch)))

(defn- reduce-commits [acc commit]
  (let [date (-> commit
                 (get "commit")
                 (get "committer")
                 (get "date")
                 (ctime/to-local-date)
                 (ctime/to-string))]
    (merge-with + acc {date 1})))

; @TODO: account for error in all requests
; @TODO: native clj transformations to transit

  ; paginate through all user repos
  (.getAll RepoApi (clj->js {"per_page" 100}) (paginate repo-ch))
  ; reduce over commits and add them together
  (go
    (->> repo-ch
         (async/reduce reduce-repos [])
         (<!)
         (async/merge)
         (async/reduce reduce-commits {})
         (<!))))
