You can now type accounts.
This commit is contained in:
@@ -82,6 +82,7 @@
|
||||
:auto-ap/add-general-ledger6 {:txes add-general-ledger/add-general-ledger :requires [:auto-ap/make-every-account-visible]}
|
||||
:auto-ap/add-general-ledger-fns2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/add-general-ledger-fns :requires [:auto-ap/add-general-ledger6]}
|
||||
:auto-ap/add-accounts {:txes auto-ap.datomic.migrate.add-general-ledger/add-accounts :requires [:auto-ap/add-general-ledger-fns2]}
|
||||
:auto-ap/add-transaction-account {:txes auto-ap.datomic.migrate.add-general-ledger/add-transaction-account :requires [:auto-ap/add-general-ledger-fns2]}
|
||||
#_#_:auto-ap/bulk-load-invoice-ledger2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/make-entity-not-unique]}
|
||||
|
||||
}]
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
:db/doc "Location of the entry"}]
|
||||
]
|
||||
)
|
||||
(def add-transaction-account
|
||||
[[{:db/ident :transaction/account
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The debit/credit for this transaction"}]])
|
||||
|
||||
(def add-accounts
|
||||
[[
|
||||
{:db/ident :account/code
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
(= "client" sort-by)
|
||||
#(-> % :transaction/client :client/name)
|
||||
|
||||
(= "account" sort-by)
|
||||
#(-> % :transaction/account :account/name)
|
||||
|
||||
:else
|
||||
(keyword "transaction" sort-by)))
|
||||
|
||||
@@ -64,6 +67,13 @@
|
||||
|
||||
(:sort-by args) (add-sorter-field {"client" ['[?e :transaction/client ?c]
|
||||
'[?c :client/name ?sorter]]
|
||||
"account" #_['[(get-else $ ?e :transaction/account 0) ?sorter]]
|
||||
['(or (and [?e :transaction/account ?c]
|
||||
[?c :account/name ?sorter])
|
||||
(and
|
||||
[?e :transaction/client]
|
||||
[(ground 0) ?c]
|
||||
[(ground "") ?sorter]))]
|
||||
"description-original" ['[?e :transaction/description-original ?sorter]]
|
||||
"date" ['[?e :transaction/date ?sorter]]
|
||||
"amount" ['[?e :transaction/amount ?sorter]]
|
||||
@@ -107,7 +117,8 @@
|
||||
(defn graphql-results [ids db args]
|
||||
(->> (d/pull-many db '[* {:transaction/client [:client/name :db/id :client/code]
|
||||
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
|
||||
:transaction/vendor [:db/id :vendor/name]}]
|
||||
:transaction/vendor [:db/id :vendor/name]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]}]
|
||||
ids)
|
||||
(map #(update % :transaction/date c/from-date))
|
||||
(map #(update % :transaction/post-date c/from-date))
|
||||
@@ -126,7 +137,8 @@
|
||||
(d/pull (d/db (d/connect uri))
|
||||
'[* {:transaction/client [:client/name :db/id :client/code]
|
||||
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
|
||||
:transaction/vendor [:db/id :vendor/name]}]
|
||||
:transaction/vendor [:db/id :vendor/name]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]}]
|
||||
id)
|
||||
(update :transaction/date c/from-date)
|
||||
(update :transaction/post-date c/from-date)
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
:status {:type 'String}
|
||||
:merchant_name {:type 'String}
|
||||
:client {:type :client}
|
||||
:account {:type :account}
|
||||
:payment {:type :payment}
|
||||
:vendor {:type :vendor}
|
||||
:bank_account {:type :bank_account}
|
||||
@@ -371,7 +372,8 @@
|
||||
:total {:type 'Float}}}
|
||||
:edit_transaction
|
||||
{:fields {:id {:type :id}
|
||||
:vendor_id {:type :id}}}}
|
||||
:vendor_id {:type :id}
|
||||
:account_id {:type :id}}}}
|
||||
|
||||
:enums {:payment_type {:values [{:enum-value :check}
|
||||
{:enum-value :cash}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
|
||||
|
||||
|
||||
(defn edit-transaction [context {{:keys [id vendor_id] :as transaction} :transaction} value]
|
||||
(defn edit-transaction [context {{:keys [id account_id vendor_id] :as transaction} :transaction} value]
|
||||
(assert-can-see-client (:id context) (:db/id (d-transactions/get-by-id id)))
|
||||
@(d/transact (d/connect uri)
|
||||
[{:db/id id
|
||||
:transaction/vendor vendor_id}])
|
||||
:transaction/vendor vendor_id
|
||||
:transaction/account account_id}])
|
||||
(->graphql (d-transactions/get-by-id id))
|
||||
#_(->graphql {:id id
|
||||
:vendor (d-vendors/get-by-id vendor_id) }))
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
(let [variables (some-> (query-params "variables")
|
||||
edn/read-string)
|
||||
body (some-> r :body slurp)]
|
||||
(println "BODY" body)
|
||||
{:status 200
|
||||
:body (pr-str (ql/query (:identity r) (doto (if (= request-method :get) (query-params "query") body) println) variables ))
|
||||
:headers {"Content-Type" "application/edn"}})
|
||||
|
||||
Reference in New Issue
Block a user