pagination.
This commit is contained in:
@@ -71,12 +71,23 @@
|
||||
q)))
|
||||
|
||||
|
||||
(defn get-graphql [{:keys [imported company-id sort-by asc]}]
|
||||
|
||||
(defn base-graphql [{:keys [imported company-id]}]
|
||||
(cond-> base-query
|
||||
(not (nil? imported)) (helpers/merge-where [:= :imported imported])
|
||||
(not (nil? company-id)) (helpers/merge-where [:= :company-id company-id])
|
||||
))
|
||||
|
||||
(defn get-graphql [{:keys [start sort-by asc] :as args}]
|
||||
(query
|
||||
(cond-> base-query
|
||||
(not (nil? imported)) (helpers/merge-where [:= :imported imported])
|
||||
(not (nil? company-id)) (helpers/merge-where [:= :company-id company-id])
|
||||
(not (nil? sort-by) ) (add-sort-by sort-by asc))))
|
||||
(cond-> (base-graphql args)
|
||||
(not (nil? sort-by) ) (add-sort-by sort-by asc)
|
||||
true (assoc :limit 20)
|
||||
start (assoc :offset start))))
|
||||
|
||||
(defn count-graphql [args]
|
||||
(:count (first (query
|
||||
(assoc (base-graphql args) :select [:%count.*])))))
|
||||
|
||||
(defn import [parsed-invoices companies vendors]
|
||||
(insert-multi!
|
||||
|
||||
Reference in New Issue
Block a user