looking good.
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user