duplicates.
This commit is contained in:
@@ -49,11 +49,18 @@
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
(POST "/pdf-upload"
|
||||
{{ files "file"} :params :as params}
|
||||
(let [{:keys [filename tempfile]} files]
|
||||
(let [{:keys [filename tempfile]} files
|
||||
existing-invoices (invoices/get-all)]
|
||||
(println existing-invoices)
|
||||
(invoices/insert-multi!
|
||||
(for [{:keys [total date invoice-number customer-identifier] :as row}
|
||||
(for [{:keys [total date invoice-number customer-identifier vendor] :as row}
|
||||
(parse/parse-file (.getPath tempfile))]
|
||||
(assoc row :imported false)))
|
||||
(assoc row
|
||||
:imported false
|
||||
:potential-duplicate (boolean (seq (filter #(and (= vendor (:vendor %))
|
||||
(= invoice-number (:invoice-number %)))
|
||||
existing-invoices)))
|
||||
)))
|
||||
{:status 200
|
||||
:body (pr-str (invoices/get-pending))
|
||||
:headers {"Content-Type" "application/edn"}}))
|
||||
|
||||
Reference in New Issue
Block a user