lots of new fixes.
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
set)]
|
||||
(set/difference existing-ids specified-ids)))
|
||||
|
||||
(defn edit-transaction [context {{:keys [id accounts vendor_id approval_status] :as transaction} :transaction} value]
|
||||
(defn edit-transaction [context {{:keys [id accounts vendor_id approval_status forecast_match] :as transaction} :transaction} value]
|
||||
(let [existing-transaction (d-transactions/get-by-id id)
|
||||
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
|
||||
deleted (deleted-accounts existing-transaction accounts)
|
||||
@@ -80,17 +80,28 @@
|
||||
(throw (ex-info (str "Location '" (str/join ", " missing-locations) "' not found on client.") {})) )
|
||||
|
||||
@(d/transact (d/connect uri)
|
||||
(concat [(remove-nils {:db/id id
|
||||
:transaction/vendor vendor_id
|
||||
:transaction/approval-status (some->> approval_status
|
||||
name
|
||||
snake->kebab
|
||||
(keyword "transaction-approval-status"))
|
||||
:transaction/accounts (map transaction-account->entity accounts)
|
||||
})]
|
||||
(map (fn [d]
|
||||
[:db/retract id :transaction/accounts d])
|
||||
deleted)))
|
||||
(doto (concat [(remove-nils {:db/id id
|
||||
:transaction/vendor vendor_id
|
||||
:transaction/approval-status (some->> approval_status
|
||||
name
|
||||
snake->kebab
|
||||
(keyword "transaction-approval-status"))
|
||||
:transaction/accounts (map transaction-account->entity accounts)
|
||||
})
|
||||
]
|
||||
(cond forecast_match
|
||||
[[:db/add id :transaction/forecast-match forecast_match]]
|
||||
|
||||
(:db/id (:transaction/forecast-match existing-transaction))
|
||||
[[:db/retract id :transaction/forecast-match (:db/id (:transaction/forecast-match existing-transaction))]]
|
||||
|
||||
:else
|
||||
[])
|
||||
|
||||
(map (fn [d]
|
||||
[:db/retract id :transaction/accounts d])
|
||||
deleted))
|
||||
clojure.pprint/pprint))
|
||||
(-> (d-transactions/get-by-id id)
|
||||
approval-status->graphql
|
||||
->graphql)))
|
||||
|
||||
Reference in New Issue
Block a user