adding more validation.
This commit is contained in:
@@ -5,6 +5,8 @@ services:
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
labels:
|
||||
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- /opt/integreat/prod/certs/:/etc/nginx/certs:ro
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
:plugins [[lein-figwheel "0.5.13"]
|
||||
[lein-pdo "0.1.1"]
|
||||
[cider/cider-nrepl "0.16.0"]]
|
||||
:jvm-opts ["-Dconfig=config/dev.edn" #_#_"--add-modules" "java.xml.bind"]}
|
||||
:jvm-opts ["-Dconfig=config/dev.edn" "--add-modules" "java.xml.bind"]}
|
||||
:uberjar {:prep-tasks [["cljsbuild" "once" "min"] "compile"]}
|
||||
:provided {:dependencies [[org.clojure/clojurescript "1.10.238"]
|
||||
[reagent "0.7.0"]
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
(when (seq (invoices/find-conflicting {:invoice-number invoice_number
|
||||
:vendor-id vendor_id
|
||||
:company-id company_id}))
|
||||
(throw (ex-info "that invoice already exists" {:invoice-number invoice_number})))
|
||||
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
|
||||
(let [vendor (-create-or-get-vendor vendor_id vendor_name)
|
||||
_ (assert-can-see-company (:id context) company_id)
|
||||
_ (when-not (:default-expense-account vendor)
|
||||
(throw (ex-info (str "Vendor '" (:name vendor) "' does not have a default expense acount.") {:vendor-id vendor_id} )))
|
||||
company (companies/get-by-id company_id)
|
||||
|
||||
[invoice] (invoices/insert-multi! [{:invoice-number invoice_number
|
||||
@@ -44,7 +46,7 @@
|
||||
:invoice-number invoice_number
|
||||
:vendor-id (:vendor-id invoice)
|
||||
:company-id (:company-id invoice)}))
|
||||
(throw (ex-info "that invoice already exists" {:invoice-number invoice_number})))
|
||||
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
|
||||
paid-amount (- (:total invoice) (:outstanding-balance invoice))
|
||||
_ (assert-can-see-company (:id context) (:company-id invoice))
|
||||
updated-invoice (invoices/update (-> in
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
(when (= "none" (:role (:identity r)))
|
||||
(throw-unauthorized))
|
||||
|
||||
(let [variables (some-> (query-params "variables")
|
||||
edn/read-string)]
|
||||
{:status 200
|
||||
:body (pr-str (ql/query (:identity r) (query-params "query") variables ))
|
||||
:headers {"Content-Type" "application/edn"}})))
|
||||
(try
|
||||
(let [variables (some-> (query-params "variables")
|
||||
edn/read-string)]
|
||||
{:status 200
|
||||
:body (pr-str (ql/query (:identity r) (query-params "query") variables ))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
(catch Exception e
|
||||
{:status 400
|
||||
:body (pr-str {:data (merge {:message (.getMessage e)} (ex-data e))})
|
||||
:headers {"Content-Type" "application/edn"}}))))
|
||||
wrap-secure))
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
(re-frame/reg-event-fx
|
||||
::invoice-create-failed
|
||||
(fn [{:keys [db]} [_ data]]
|
||||
{:dispatch [::events/modal-failed ::new-invoice "That invoice already exists."]}))
|
||||
{:dispatch [::events/modal-failed ::new-invoice (:message data)]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::invoice-created
|
||||
|
||||
Reference in New Issue
Block a user