can edit.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
[clj-time.periodic :as p]
|
||||
[clj-time.predicates :as pred]
|
||||
[clojure.data.json :as json]
|
||||
[compojure.core :refer [GET POST context defroutes
|
||||
[compojure.core :refer [GET PUT POST context defroutes
|
||||
wrap-routes]])
|
||||
(:import (org.joda.time DateTime)))
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
(defroutes routes
|
||||
(context "/reminders" []
|
||||
|
||||
(POST "/send" {:keys [query-params headers body] :as x}
|
||||
(let [notification-type (get headers "x-amz-sns-message-type")]
|
||||
(println "Received notification " notification-type)
|
||||
@@ -70,9 +71,14 @@
|
||||
{:status 200
|
||||
:body "{}"
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(wrap-routes (GET "/" {:keys [query-params]}
|
||||
{:status 200
|
||||
:body (pr-str (map replace-joda (reminders/get-all)))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
wrap-secure)))
|
||||
(wrap-routes
|
||||
(PUT "/:id" {:keys [ edn-params] {:keys [id] } :route-params}
|
||||
(let [id (if (int? id)
|
||||
id
|
||||
(Integer/parseInt id))]
|
||||
(assert (not (:sent (reminders/get-by-id id))))
|
||||
(reminders/update! id edn-params)
|
||||
{:status 200
|
||||
:body "{}"
|
||||
:headers {"Content-Type" "application/edn"}}))
|
||||
wrap-secure)))
|
||||
|
||||
Reference in New Issue
Block a user