(ns auto-ap.routes.ezcater (:require [auto-ap.ezcater.core :as e] [auto-ap.logging :as alog] [ring.middleware.json :refer [wrap-json-params]])) (defn handle-ezcater [{:keys [request-method json-params] :as r}] (cond (= :get request-method) {:status 200 :headers {"Content-Type" "application/json"} :body "{}"} (= :post request-method) (do (alog/info ::ezcater-request :json-params json-params) (e/import-order json-params) {:status 200 :headers {"Content-Type" "application/json"} :body "{}"}) :else {:status 404})) (def routes {"api/" {"ezcater/" {#"event/?" :ezcater-event}}}) (def match->handler {:ezcater-event (-> handle-ezcater wrap-json-params)})