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]
|
||||
|
||||
Reference in New Issue
Block a user