Adding reminders view

This commit is contained in:
Bryce Covert
2018-04-06 18:29:48 -07:00
parent 6e573a0a57
commit 982d5ade58
10 changed files with 107 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
(ns auto-ap.db.reminders
(:require [clojure.java.jdbc :as j]
[auto-ap.parse :as parse]
[auto-ap.db.utils :refer [clj->db db->clj get-conn]]))
(defn get-all []
(doto (map db->clj (j/query (get-conn) "SELECT reminders.*, vendors.name as vendor_name FROM reminders INNER join vendors on reminders.vendor_id = vendors.id"))
println))

View File

@@ -1,6 +1,8 @@
(ns auto-ap.routes.reminders
(:require [compojure.core :refer [context GET POST defroutes]]
(:require [compojure.core :refer [context GET POST defroutes wrap-routes]]
[auto-ap.db.vendors :as vendors]
[auto-ap.db.reminders :as reminders]
[auto-ap.routes.utils :refer [wrap-secure]]
[amazonica.aws.simpleemail :as ses]
))
@@ -18,4 +20,10 @@
:text (str "Hello " name ",\r\nThis is a reminder to send this week's invoices to us. You can just reply to this email.\r\n - Integreat.")}})))
{:status 200
:body "{}"
:headers {"Content-Type" "application/edn"}})))
:headers {"Content-Type" "application/edn"}})
(wrap-routes (GET "/" {:keys [query-params]}
{:status 200
:body (pr-str (reminders/get-all))
:headers {"Content-Type" "application/edn"}})
wrap-secure)))