             [tictag.jwt :as jwt]
             [tictag.schemas :as schemas]
             [clojure.spec.alpha :as s]
-            [tictag.tagtime :as tagtime]))
+            [tictag.tagtime :as tagtime]
+            [taoensso.timbre :as timbre]))
 
 (taoensso.timbre/refer-timbre)
 (def wtf (f/formatter "yyyy-MM-dd HH:mm:SS"))

            user (jwt/unsign jwt token)]
        (handler (assoc req :user-id (:user-id user)))))))

(defn tagtime-import [{:keys [db]} {:keys [params user-id]}]
  (taoensso.timbre/logged-future
   (if-let [parsed (tagtime/parse user-id (:tagtime-log params))]
     (db/insert-tagtime-data db parsed)
     (debugf "Invalid tagtime data received from user-id %d" user-id)))
  (response {:accepted true}))

(defn tagtime-import-from-file [{:keys [db]} {:keys [multipart-params user-id]}]
  (taoensso.timbre/logged-future
   (debug multipart-params)
   (if-let [parsed (tagtime/parse user-id (slurp (get-in multipart-params ["tagtime-log" :tempfile])))]
     (db/insert-tagtime-data db parsed)
     (debugf "Invalid tagtime data received from user-id %d" user-id)))
  (response {:accepted true}))


   (GET "/about" _ (index component))
   (GET "/settings" _ (index component))
   (context "/api" []
            (PUT "/tagtime" _ (partial tagtime-import-from-file component))
            (GET "/timezones" _ (partial timezone-list component))
            (GET "/user/me" _ (partial my-user component))
