it's now possible to link across each entity type

This commit is contained in:
Bryce Covert
2021-01-24 09:45:13 -08:00
parent 88b0dcde3b
commit 10785b9c85
13 changed files with 161 additions and 105 deletions

View File

@@ -12,6 +12,10 @@
(update :payment/date c/from-date)
(update :payment/status :db/ident)
(update :payment/type :db/ident)
(update :transaction/_payment (fn [transactions]
(mapv (fn [transaction]
(update transaction :transaction/date c/from-date))
transactions)))
(rename-keys {:invoice-payment/_payment :payment/invoices})))
(def default-read '[*
@@ -21,7 +25,8 @@
{:payment/vendor [:vendor/name {:vendor/default-account
[:account/name :account/numeric-code :db/id]} :db/id {:vendor/primary-contact [*]} {:vendor/address [*]}]}
{:payment/status [:db/ident]}
{:payment/type [:db/ident]}])
{:payment/type [:db/ident]}
{:transaction/_payment [:db/id :transaction/date]}])
(defn raw-graphql-ids [db args]
(let [check-number-like (try (Long/parseLong (:check-number-like args)) (catch Exception e nil))

View File

@@ -27,6 +27,10 @@
:args [db]}
(:exact-match-id args)
(merge-query {:query {:in ['?e]
:where []}
:args [(:exact-match-id args)]})
(limited-clients (:id args))
(merge-query {:query {:in ['[?xx ...]]
@@ -151,6 +155,7 @@
:transaction/forecast-match [:db/id :forecasted-transaction/identifier]
:transaction/vendor [:db/id :vendor/name]
:transaction/matched-rule [:db/id :transaction-rule/note]
:transaction/payment [:db/id :payment/date]
:transaction/accounts [:transaction-account/amount
:db/id
:transaction-account/location
@@ -159,6 +164,7 @@
ids)
(map #(update % :transaction/date c/from-date))
(map #(update % :transaction/post-date c/from-date))
(map #(update-in % [:transaction/payment :payment/date] c/from-date))
(map #(dissoc % :transaction/id))
(group-by :db/id))]
(->> ids

View File

@@ -20,7 +20,9 @@
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.string :as str]
[config.core :refer [env]])
[config.core :refer [env]]
[clojure.tools.logging :as log]
[clojure.set :as set])
(:import java.io.ByteArrayOutputStream
java.text.DecimalFormat
java.util.UUID))
@@ -341,7 +343,15 @@
(defn get-payment-page [context args value]
(let [args (assoc args :id (:id context))
[payments checks-count] (d-checks/get-graphql (<-graphql args))]
[{:payments (map ->graphql payments)
[{:payments (->> payments
(map (fn [payment]
(if (seq (:transaction/_payment payment))
(-> payment
(set/rename-keys {:transaction/_payment :transaction})
(update :transaction first))
payment)))
(map ->graphql ))
:total checks-count
:count (count payments)
:start (:start args 0)

View File

@@ -18,7 +18,11 @@
(defn get-invoice-page [context args value]
(let [args (assoc args :id (:id context))
[invoices invoice-count outstanding] (d-invoices/get-graphql (update (<-graphql (assoc args :id (:id context))) :status enum->keyword "invoice-status"))]
[invoices invoice-count outstanding] (-> args
(assoc :id (:id context))
(<-graphql )
(update :status enum->keyword "invoice-status")
(d-invoices/get-graphql ))]
[{:invoices (map ->graphql invoices)
:outstanding outstanding
:total invoice-count