looking good.

This commit is contained in:
Bryce Covert
2017-12-08 08:53:34 -08:00
parent dc5eb781a9
commit 70858fd424
7 changed files with 76 additions and 56 deletions

View File

@@ -20,6 +20,11 @@
:body (pr-str (invoices/get-all))
:headers {"Content-Type" "application/edn"}})
(GET "/api/invoices/unpaid" []
{:status 200
:body (pr-str (invoices/get-unpaid))
:headers {"Content-Type" "application/edn"}})
(GET "/api/invoices/pending" []
{:status 200
:body (pr-str (invoices/get-pending))
@@ -33,12 +38,13 @@
(POST "/pdf-upload"
{{ files "file"} :params :as params}
(let [{:keys [filename tempfile]} files]
(for [{:keys [total date invoice-number customer-identifier]}
(parse/parse-file (.getPath tempfile))]
{"customer-identifier" customer-identifier
"invoice-number" invoice-number
"date" date
"total" total})))
(invoices/insert-multi!
(for [{:keys [total date invoice-number customer-identifier] :as row}
(parse/parse-file (.getPath tempfile))]
(assoc row :imported false)))
{:status 200
:body (pr-str (invoices/get-pending))
:headers {"Content-Type" "application/edn"}}))
(route/resources "/")
(routes (ANY "*" [] (response/resource-response "index.html" {:root "public"})))
(route/not-found "Not Found"))