              [admin :as admin]
              [ticket :as ticket]
              [events :as events]
-             [checkin :as checkin]]))
+             [checkin :as checkin]]
+            [clj-time
+             [format :as format]
+             [local :as local]]))
+
+(def format (format/formatter "yyyy-MM-dd HH:mm"))
+
+(defn- str->datetime [s]
+  (local/to-local-date-time (format/parse format s)))
 
 (defroutes ^:private admin-routes*
   (POST "/users" {{:keys [name password phone email]} :params}

(ns checkin-halake.routes.admin
  (:require [compojure.core :refer [defroutes GET POST PUT]]
            [checkin-halake.util :as util]
            [checkin-halake.models

          (when (and user (contains? ticket/ticket-types type))
            (ticket/add-ticket-to-user user type count)
            (let [tickets (ticket/available-tickets user)]
              (util/response-with-status true :tickets tickets)))))
  (POST "/events" {{:keys [title image-url event-at content-url]} :params}
        (if-let [event-at (try (str->datetime event-at)
                               (catch IllegalArgumentException _ nil))]
          (let [event (events/register-event title image-url event-at content-url)]
            (util/response-with-status true :event event))
          (util/response-with-status false :reason "Wrong datetime format"))))

(defn- wrap-check-admin [app]
  (fn [{:keys [user] :as req}]
