vendors.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
[buddy.auth.backends.token :refer [jws-backend]]
|
||||
[buddy.auth.middleware :refer [wrap-authorization wrap-authentication]]
|
||||
[auto-ap.db.companies :as companies]
|
||||
[auto-ap.db.vendors :as vendors]
|
||||
[amazonica.core :refer [defcredential]]
|
||||
[amazonica.aws.simpleemail :as ses]))
|
||||
(defn best-match [companies company-identifier]
|
||||
@@ -88,6 +89,11 @@
|
||||
{:status 200
|
||||
:body (pr-str (companies/get-all))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(GET "/api/vendors" []
|
||||
{:status 200
|
||||
:body (pr-str (vendors/get-all))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(GET "/api/invoices" []
|
||||
{:status 200
|
||||
@@ -105,7 +111,7 @@
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(POST "/api/reminders/send" {:keys [query-params]}
|
||||
(doseq [{:keys [name email invoice-reminder-schedule]} (companies/get-all)]
|
||||
(doseq [{:keys [name email invoice-reminder-schedule]} (vendors/get-all)]
|
||||
(when (= "Weekly" invoice-reminder-schedule)
|
||||
(println "Sending email to" email)
|
||||
(ses/send-email :destination {:to-addresses [email]}
|
||||
@@ -122,6 +128,11 @@
|
||||
:body (pr-str (companies/upsert id edn-params))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(PUT "/api/vendors/:id" {:keys [edn-params] {:keys [id]} :route-params :as r}
|
||||
{:status 200
|
||||
:body (pr-str (vendors/upsert id edn-params))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
(POST "/api/invoices" {:keys [edn-params]}
|
||||
(invoices/insert-multi! (:rows edn-params))
|
||||
{:status 200
|
||||
|
||||
Reference in New Issue
Block a user