transaction date range. Need to generalize filter changing.
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
(:require [datomic.api :as d]
|
||||
[auto-ap.datomic :refer [uri merge-query apply-sort-2 apply-sort apply-pagination add-sorter-field]]
|
||||
[auto-ap.graphql.utils :refer [limited-clients]]
|
||||
[clj-time.coerce :as c]))
|
||||
[clj-time.coerce :as c]
|
||||
[clj-time.coerce :as coerce]))
|
||||
|
||||
(defn sort-fn [sort-by]
|
||||
(cond
|
||||
@@ -51,6 +52,17 @@
|
||||
(merge-query {:query {:in ['?client-id]
|
||||
:where ['[?e :transaction/client ?client-id]]}
|
||||
:args [(:client-id args)]})
|
||||
(:start (:date-range args))
|
||||
(merge-query {:query {:in ['?start-date]
|
||||
:where ['[?e :transaction/date ?date]
|
||||
'[(>= ?date ?start-date)]]}
|
||||
:args [(coerce/to-date (:start (:date-range args)))]})
|
||||
|
||||
(:end (:date-range args))
|
||||
(merge-query {:query {:in ['?end-date]
|
||||
:where ['[?e :transaction/date ?date]
|
||||
'[(<= ?date ?end-date)]]}
|
||||
:args [(coerce/to-date (:end (:date-range args)))]})
|
||||
|
||||
(:client-code args)
|
||||
(merge-query {:query {:in ['?client-code]
|
||||
|
||||
@@ -325,6 +325,7 @@
|
||||
:transaction_page {:type '(list :transaction_page)
|
||||
:args {:client_id {:type :id}
|
||||
:bank_account_id {:type :id}
|
||||
:date_range {:type :date_range}
|
||||
:start {:type 'Int}
|
||||
:sort_by {:type 'String}
|
||||
:asc {:type 'Boolean}}
|
||||
@@ -368,6 +369,9 @@
|
||||
:invoice_payment_amount {:fields {:invoice_id {:type :id}
|
||||
:amount {:type 'Float}}}
|
||||
|
||||
:date_range {:fields {:start {:type :iso_date}
|
||||
:end {:type :iso_date}}}
|
||||
|
||||
:import_ledger_line_item {:fields {:account_identifier {:type 'String}
|
||||
:location {:type 'String}
|
||||
:debit {:type 'String}
|
||||
|
||||
Reference in New Issue
Block a user