starting to be able to choose invoices

This commit is contained in:
Bryce Covert
2018-05-10 21:08:45 -07:00
parent 798bfae78a
commit 5fb5b2d412
11 changed files with 269 additions and 59 deletions

View File

@@ -51,6 +51,10 @@
(defn get-all []
(query base-query))
(defn get-multi [ids]
(query (-> base-query
(helpers/merge-where [:in :id ids]))))
(defn approve []
(j/update! (get-conn) :invoices {:imported true} [] ))

View File

@@ -6,6 +6,7 @@
[auto-ap.routes.reminders :as reminders]
[auto-ap.routes.graphql :as graphql]
[auto-ap.routes.vendors :as vendors]
[auto-ap.routes.checks :as checks]
[buddy.auth.backends.token :refer [jws-backend]]
[buddy.auth.middleware :refer [wrap-authentication
wrap-authorization]]
@@ -31,6 +32,7 @@
companies/routes
vendors/routes
reminders/routes
checks/routes
graphql/routes
auth/routes))

View File

@@ -0,0 +1,21 @@
(ns auto-ap.routes.checks
(:require [auto-ap.db.companies :as companies]
[auto-ap.db.vendors :as vendors]
[auto-ap.db.invoices :as invoices]
[auto-ap.db.utils :refer [query]]
[auto-ap.parse :as parse]
[auto-ap.routes.utils :refer [wrap-secure]]
[compojure.core :refer [GET POST context defroutes
wrap-routes]]
[clojure.string :as str]))
(defroutes routes
(wrap-routes
(context "/checks" []
(POST "/" {:keys [edn-params]}
(invoices/get-multi (:invoice-ids edn-params))
{:status 200
:body (pr-str (invoices/get-multi (:invoice-ids edn-params)))
:headers {"Content-Type" "application/edn"}}))
wrap-secure))