Most parts of staging ought to work

This commit is contained in:
Bryce Covert
2020-12-26 14:10:51 -08:00
parent a46b58fe00
commit 3b39a6fa0a
7 changed files with 340 additions and 158 deletions

282
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,79 +5,97 @@
:repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"
:username "datomic@brycecovertoperations.com"
:password "9a382afc-d119-44db-83c2-98d8057d7666"}}
:dependencies [[org.clojure/clojure "1.9.0"]
[com.datomic/datomic-pro "0.9.5703"
:dependencies [[org.clojure/clojure "1.10.1"]
[com.datomic/datomic-pro "0.9.5783"
:exclusions [com.google.guava/guava
org.apache.httpcomponents/httpclient
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j]]
[compojure "1.6.1" :exclusions [ring]]
[bidi "2.1.2"]
[ring/ring-defaults "0.2.1"]
[compojure "1.6.2" :exclusions [ring
ring/ring-core]]
[bidi "2.1.6"]
[ring/ring-defaults "0.3.2" :exclusions [ring ring/ring-core]]
[mount "0.1.16"]
[tolitius/yang "0.1.10"]
[ring "1.6.3" :exclusions [commons-codec
[tolitius/yang "0.1.23"]
[ring "1.8.2" :exclusions [commons-codec
commons-io
clj-time
ring/ring-core
ring/ring-codec
org.eclipse.jetty/jetty-http
org.eclipse.jetty/jetty-util
org.eclipse.jetty/jetty-server]]
[yogthos/config "0.8"]
[dk.ative/docjure "1.12.0"]
#_org.eclipse.jetty/jetty-http
#_org.eclipse.jetty/jetty-util
#_org.eclipse.jetty/jetty-server]]
[ring/ring-jetty-adapter "1.8.2" :exclusions
[org.eclipse.jetty/jetty-server]]
[yogthos/config "1.1.7"]
[dk.ative/docjure "1.14.0"]
[clj-fuzzy "0.4.1"]
[com.walmartlabs/lacinia "0.25.0"]
[com.walmartlabs/lacinia "0.37.0"]
[vincit/venia "0.2.5"]
[digest "1.4.8"]
[clj-http "3.7.0" :exclusions [org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpcore]]
[clj-pdf "2.2.33"]
[org.clojure/core.async "0.3.465"]
[digest "1.4.10"]
[clj-http "3.11.0" :exclusions [org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpcore]]
[clj-pdf "2.5.5"]
[org.clojure/core.async "1.3.610"]
[fogus/ring-edn "0.3.0"]
[buddy/buddy-auth "2.1.0"
[buddy/buddy-auth "2.2.0"
:exclusions [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor
com.fasterxml.jackson.core/jackson-core]]
[nrepl "0.6.0" :exclusions [org.clojure/tools.logging]]
[nrepl "0.8.3" :exclusions [org.clojure/tools.logging]]
[org.clojure/tools.logging "1.1.0"]
[ch.qos.logback/logback-classic "1.2.3"]
[ch.qos.logback/logback-classic "1.2.3" ]
[ch.qos.logback/logback-core "1.2.3" ]
[ch.qos.logback.contrib/logback-jackson "0.1.5"]
[ch.qos.logback.contrib/logback-json-classic "0.1.5"]
[spootnik/unilog "0.7.24"
[spootnik/unilog "0.7.27"
:exclusions [com.fasterxml.jackson.core/jackson-core
com.fasterxml.jackson.core/jackson-databind]]
[clj-time "0.14.3"]
[ring/ring-json "0.4.0" :exclusions [cheshire]]
[clj-time "0.15.2"]
[ring/ring-json "0.5.0" :exclusions [cheshire]]
[com.cemerick/url "0.1.1"]
[bk/ring-gzip "0.3.0"]
[amazonica "0.3.121"
[amazonica "0.3.153"
:exclusions [com.amazonaws/aws-java-sdk
com.amazonaws/amazon-kinesis-client]]
[com.amazonaws/aws-java-sdk-core "1.11.600"
[com.amazonaws/aws-java-sdk-core "1.11.926"
:exclusions [commons-codec
commons-logging]]
[com.amazonaws/aws-java-sdk-ses "1.11.600"
[com.amazonaws/aws-java-sdk-ses "1.11.926"
:exclusions [commons-codec
org.apache.httpcomponents/httpclient]]
[com.amazonaws/aws-java-sdk-s3 "1.11.600"
[com.amazonaws/aws-java-sdk-s3 "1.11.926"
:exclusions [commons-codec
org.apache.httpcomponents/httpclient]]
[com.amazonaws/aws-java-sdk-dynamodb "1.11.600"
[com.amazonaws/aws-java-sdk-dynamodb "1.11.926"
:exclusions [commons-codec
org.apache.httpcomponents/httpclient]]
[org.eclipse.jetty/jetty-http "9.4.17.v20190418"]
[org.eclipse.jetty/jetty-util "9.4.17.v20190418"]
[org.eclipse.jetty/jetty-server "9.4.17.v20190418"]
[org.eclipse.jetty.websocket/websocket-server "9.4.17.v20190418"]
[org.eclipse.jetty.websocket/websocket-servlet "9.4.17.v20190418"]
[org.clojure/data.json "0.2.6"]
[org.clojure/data.csv "0.1.4"]
[io.rkn/conformity "0.5.1"]
#_[org.eclipse.jetty/jetty-http "11.0.0"]
#_[org.eclipse.jetty/jetty-util "11.0.0"]
#_[org.eclipse.jetty/jetty-server "11.0.0"]
[org.eclipse.jetty.websocket/websocket-servlet "9.4.35.v20201120"]
[org.eclipse.jetty.websocket/websocket-server "9.4.35.v20201120"]
#_[org.eclipse.jetty.websocket/websocket-servlet "11.0.0"]
[org.clojure/data.json "1.0.0"]
[org.clojure/data.csv "1.0.0"]
[io.rkn/conformity "0.5.4"]
[hiccup "1.0.5"]]
[hiccup "1.0.5"]
;; needed for java 11
[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]]
:managed-dependencies [;; explicit dependencies to get to latest versions for above
[com.fasterxml.jackson.core/jackson-core "2.12.0"]
[com.fasterxml.jackson.core/jackson-databind "2.12.0"]
[com.fasterxml.jackson.core/jackson-annotations "2.12.0"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.12.0"]
[commons-codec "1.12"]]
:plugins [[lein-ring "0.9.7"]
[lein-cljsbuild "1.1.5"]]
[lein-cljsbuild "1.1.5"]
[lein-ancient "0.6.15"]]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:ring {:handler auto-ap.handler/app}
:source-paths ["src/clj" "src/cljc" "src/cljs"]
@@ -86,12 +104,13 @@
"fig:dev" ["run" "-m" "figwheel.main" "-b" "dev" "-r"]
"fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "min"]}
:profiles
{:dev
{:resource-paths ["resources" "target"]
:dependencies [[binaryage/devtools "0.9.4"]
:dependencies [[binaryage/devtools "1.0.2"]
[postgresql/postgresql "9.3-1102.jdbc41"]
[org.clojure/java.jdbc "0.7.3"]
[org.clojure/java.jdbc "0.7.11"]
[com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript
ring
ring/ring-core
@@ -99,7 +118,6 @@
ring/ring-defaults
ring/ring-devel
org.clojure/tools.cli
ring.adapter.jetty
binaryage/devtools
commons-io
commons-codec
@@ -110,9 +128,10 @@
args4j]]
[com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [org.clojure/clojurescript]]
[javax.servlet/servlet-api "2.5"]]
:plugins [
[lein-pdo "0.1.1"]]
:jvm-opts ["-Dconfig=config/dev.edn" "--add-modules" "java.xml.bind"]}
:plugins [[lein-pdo "0.1.1"]]
:jvm-opts ["-Dconfig=config/dev.edn" "-Dlogback.configurationFile=logback.xml"]}
:uberjar {:prep-tasks ["fig:min" ]
:dependencies [[com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript
ring
@@ -130,17 +149,17 @@
org.eclipse.jetty.websocket/websocket-server
org.eclipse.jetty.websocket/websocket-servlet
args4j]]]}
:provided {:dependencies [[org.clojure/clojurescript "1.10.764"
:provided {:dependencies [[org.clojure/clojurescript "1.10.773"
:exclusions [com.google.code.findbugs/jsr305
com.fasterxml.jackson.core/jackson-core]]
[reagent "1.0.0-alpha2" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
[re-frame "0.10.2"
[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
[re-frame "1.1.2"
:exclusions
[reagent
org.clojure/clojurescript]]
[re-frame-utils "0.1.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[cljs-http "0.1.44"]
[cljs-http "0.1.46"]
[kibu/pushy "0.3.8"]]}}
:main auto-ap.server

View File

@@ -34,27 +34,44 @@
(def integreat-schema
{
:scalars {:id {:parse (schema/as-conformer #(when % (Long/parseLong %)))
:serialize (schema/as-conformer #(.toString %))}
:ident {:parse (schema/as-conformer (fn [x] {:db/ident x}))
:serialize (schema/as-conformer #(or (:ident %) (:db/ident %) %))}
:iso_date {:parse (schema/as-conformer #(time/parse % time/iso-date))
:serialize (schema/as-conformer #(time/unparse % time/iso-date))}
:money {:parse (schema/as-conformer #(if (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
%))
:serialize (schema/as-conformer #(if (double? %)
(str %)
%))
:scalars {:id {:parse #(when % (Long/parseLong %))
:serialize #(.toString %)}
:ident {:parse (fn [x] {:db/ident x})
:serialize #(or (:ident %) (:db/ident %) %)}
:iso_date {:parse #(time/parse % time/iso-date)
:serialize #(time/unparse % time/iso-date)}
:money {:parse #(do
(log/info "parsing money...")
(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
(int? %)
(double %)
:else
%))
:serialize #(cond (double? %)
(str %)
(int? %)
(str %)
:else
%)
}
:percentage {:parse (schema/as-conformer #(if (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
%))
:serialize (schema/as-conformer #(if (double? %)
(str %)
%))}}
:percentage {:parse #(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
(int? %)
(str %)
:else
%)
:serialize #(if (double? %)
(str %)
%)}}
:objects
{
:message
@@ -648,7 +665,7 @@
:external_id_like {:type 'String}
:sort {:type '(list :sort_item)}}}
:invoice_payment_amount {:fields {:invoice_id {:type :id}
:amount {:type 'Float}}}
:amount {:type :money}}}
:edit_location_match {:fields {:location {:type 'String}
:match {:type 'String}
:id {:type :id}}}
@@ -766,20 +783,20 @@
{:fields {:id {:type :id}
:account_id {:type :id}
:location {:type 'String}
:amount {:type 'String}}}
:amount {:type :money}}}
:add_invoice
{:fields {:id {:type :id}
:invoice_number {:type 'String}
:expense_accounts {:type '(list :edit_expense_account)}
:location {:type :iso_date}
:location {:type 'String}
:scheduled_payment {:type :iso_date}
:date {:type :iso_date}
:due {:type :iso_date}
:client_id {:type :id}
:vendor_id {:type :id}
:vendor_name {:type 'String}
:total {:type 'Float}}}
:total {:type :money}}}
:edit_invoice
{:fields {:id {:type :id}
@@ -788,7 +805,7 @@
:date {:type :iso_date}
:scheduled_payment {:type :iso_date}
:due {:type :iso_date}
:total {:type 'Float}}}
:total {:type :money}}}
:edit_transaction
{:fields {:id {:type :id}
:vendor_id {:type :id}
@@ -1285,9 +1302,16 @@
result)
(catch Exception e
(if-let [v (:validation-error (ex-data e))]
(warn-event "validation error" {:validation-error v
:data (ex-data e)})
(error-event "query error" {:error e}))
(if-let [v (or (:validation-error (ex-data e))
(:validation-error (ex-data (.getCause e)))
)]
(do
(warn-event "validation error" {:validation-error v
:data (ex-data e)})
(throw (Exception. v))
#_{:errors [{:message v}]})
(do
(error-event "query error" {:error e})
(throw e))))))
(throw e))))))))

View File

@@ -54,7 +54,7 @@
(defn expense-account->entity [{:keys [id account_id amount location]}]
(remove-nils #:invoice-expense-account {:amount (Double/parseDouble amount)
(remove-nils #:invoice-expense-account {:amount amount
:db/id id
:account account_id
:location location}))
@@ -160,7 +160,7 @@
:invoice/client (:db/id (:invoice/client invoice))}))
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
expense-account-total (reduce + 0 (map (fn [x] (Double/parseDouble (:amount x))) expense_accounts))
expense-account-total (reduce + 0 (map (fn [x] (:amount x)) expense_accounts))
_ (when-not (dollars= total expense-account-total)
(let [error (str "Expense account total (" expense-account-total ") does not equal invoice total (" total ")")]
(throw (ex-info error {:validation-error error}))))

View File

@@ -119,7 +119,7 @@
(defn transaction-account->entity [{:keys [id account_id amount location]}]
(remove-nils #:transaction-account {:amount (Double/parseDouble amount)
(remove-nils #:transaction-account {:amount amount
:db/id id
:account account_id
:location location}))
@@ -163,7 +163,7 @@
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
_ (assert-valid-expense-accounts accounts)
deleted (deleted-accounts existing-transaction accounts)
account-total (reduce + 0 (map (fn [x] (Double/parseDouble (:amount x))) accounts))
account-total (reduce + 0 (map (fn [x] (:amount x)) accounts))
missing-locations (seq (set/difference
(->> accounts
(map :location)

View File

@@ -34,7 +34,7 @@
:headers {"Content-Type" "application/edn"}})
(do (log/error "GraphQL error" e)
{:status 500
:body (pr-str {:errors [(merge {:message (str "Unhandled error:" (str e))} (ex-data e))]})
:body (pr-str {:errors [(merge {:message (str "Unhandled error:" (str e))} #_(ex-data e))]})
:headers {"Content-Type" "application/edn"}}))))))

View File

@@ -101,7 +101,7 @@
:signature-data (:signature-data new-client-data)
:forecasted-transactions (map (fn [{:keys [id day-of-month identifier amount]}]
{:id id
:day-of-month day-of-month
:day-of-month (js/parseInt day-of-month)
:identifier identifier
:amount amount})
(:forecasted-transactions new-client-data))
@@ -159,11 +159,10 @@
(let [new-client-req @(re-frame/subscribe [::new-client-request])
user @(re-frame/subscribe [::subs/token])]
{:db (-> new-client-form
(assoc :status :loading)
(assoc :error nil))
{:db (-> new-client-form)
:graphql
{:token user
:owns-state {:single ::form}
:query-obj {:venia/operation {:operation/type :mutation
:operation/name "EditClient"}
:venia/queries [{:query/data [:edit-client