removing vestiges of http.

This commit is contained in:
Bryce Covert
2018-11-09 13:39:47 -08:00
parent 8ea4ea0c73
commit e15245690d
4 changed files with 33 additions and 66 deletions

View File

@@ -5,7 +5,6 @@
[auto-ap.routes.invoices :as invoices]
[auto-ap.routes.reminders :as reminders]
[auto-ap.routes.graphql :as graphql]
[auto-ap.routes.vendors :as vendors]
[auto-ap.routes.yodlee :as yodlee]
[auto-ap.routes.events :as events]
[auto-ap.routes.checks :as checks]
@@ -36,7 +35,6 @@
yodlee/routes
invoices/routes
companies/routes
vendors/routes
reminders/routes
checks/routes
graphql/routes

View File

@@ -13,6 +13,22 @@
wrap-routes]])
(:import (org.joda.time DateTime)))
#_(POST "/:id/remind" {:keys [edn-params] {:keys [id :<< as-int]} :route-params :as r}
(assert-admin (:identity r))
(let [id (if (int? id)
id
(Integer/parseInt id))
vendor (vendors/get-by-id id)]
(reminders/insert (assoc
(reminders/template)
:email (:primary-email vendor)
:vendor-id id
:scheduled (time/now)))
(-> (reminders/get-ready)
(reminders/send-emails))
{:status 200
:body "{}"
:headers {"Content-Type" "application/edn"}}))
#_(defn next-sunday []
(let [sunday (->> (p/periodic-seq (time/plus (time/today) (time/days 1)) (time/days 1))
(filter pred/sunday?)

View File

@@ -1,47 +0,0 @@
(ns auto-ap.routes.vendors
(:require [auto-ap.db.vendors :as vendors]
[auto-ap.entities.vendors :as entity]
[auto-ap.graphql.utils :refer [assert-admin]]
[auto-ap.routes.utils :refer [wrap-secure wrap-spec]]
[auto-ap.db.reminders :as reminders]
[clj-time.core :as time]
[compojure.core :refer [GET POST PUT context defroutes wrap-routes]]))
(defroutes routes
(wrap-routes
(context "/vendors" []
(GET "/" []
{:status 200
:body (pr-str (vendors/get-all))
:headers {"Content-Type" "application/edn"}})
(wrap-routes
(PUT "/:id" {:keys [edn-params] {:keys [id]} :route-params :as r}
(assert-admin (:identity r))
{:status 200
:body (pr-str (vendors/upsert id edn-params))
:headers {"Content-Type" "application/edn"}})
#(wrap-spec % ::entity/vendor))
(POST "/:id/remind" {:keys [edn-params] {:keys [id :<< as-int]} :route-params :as r}
(assert-admin (:identity r))
(let [id (if (int? id)
id
(Integer/parseInt id))
vendor (vendors/get-by-id id)]
(reminders/insert (assoc
(reminders/template)
:email (:primary-email vendor)
:vendor-id id
:scheduled (time/now)))
(-> (reminders/get-ready)
(reminders/send-emails))
{:status 200
:body "{}"
:headers {"Content-Type" "application/edn"}}))
(wrap-routes
(POST "/" {:keys [edn-params] :as r}
{:status 200
:body (pr-str (vendors/insert edn-params))
:headers {"Content-Type" "application/edn"}})
#(wrap-spec % ::entity/vendor)))
wrap-secure))