adding transaction rules.

This commit is contained in:
Bryce Covert
2019-05-07 07:10:21 -07:00
parent 918f2e5be1
commit a1abb4b05e
15 changed files with 266 additions and 15 deletions

View File

@@ -5,7 +5,7 @@
[auto-ap.datomic.accounts :as a]
[auto-ap.utils :refer [by dollars=]]
[auto-ap.time :refer [parse iso-date]]
[auto-ap.graphql.utils :refer [->graphql <-graphql limited-clients assert-admin]]
[auto-ap.graphql.utils :refer [->graphql <-graphql limited-clients assert-admin result->page]]
[clj-time.coerce :as coerce]
[clojure.string :as str]
[clj-time.core :as time]
@@ -16,13 +16,8 @@
(defn get-ledger-page [context args value]
(let [args (assoc args :id (:id context))
[journal-entries journal-entries-count] (l/get-graphql (<-graphql args))
journal-entries (map ->graphql journal-entries)]
{:journal_entries journal-entries
:total journal-entries-count
:count (count journal-entries)
:start (:start args 0)
:end (+ (:start args 0) (count journal-entries))}))
[journal-entries journal-entries-count] (l/get-graphql (<-graphql args))]
(result->page journal-entries journal-entries-count :journal_entries args)))
;; TODO a better way to do this might be to accumulate ALL credits and ALL debits, and then just do for credits: balance = credits - debits. and for debits balance = debits - credits
(defn credit-account? [account]