merged.
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
|
||||
(defn raw-graphql [args]
|
||||
(->> (d/query
|
||||
(cond-> {:query {:find ['(pull ?e [* {:transaction/client [:client/name :db/id]}])]
|
||||
(cond-> {:query {:find ['(pull ?e [* {:transaction/client [:client/name :db/id]
|
||||
:transaction/bank-account [:bank-account/name :bank-account/yodlee-account-id]}])]
|
||||
:in ['$]
|
||||
:where ['[?e :transaction/original-id]]}
|
||||
:args [(d/db (d/connect uri))]}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
:else
|
||||
q)))
|
||||
|
||||
(defn base-graphql [{:keys [company-id vendor-id check-number bank-account-id status amount id]}]
|
||||
(defn base-graphql [{:keys [company-id vendor-id check-number bank-account-id status amount id statuses]}]
|
||||
|
||||
(cond-> base-query
|
||||
(limited-companies id) (helpers/merge-where [:in :company-id (limited-companies id)])
|
||||
@@ -89,7 +89,8 @@
|
||||
(not (nil? vendor-id)) (helpers/merge-where [:= :vendor-id vendor-id])
|
||||
(not (nil? check-number)) (helpers/merge-where [:= :check-number check-number])
|
||||
(not (nil? status)) (helpers/merge-where [:= :status status])
|
||||
(not (nil? amount)) (helpers/merge-where [:= :amount amount])))
|
||||
(not (nil? amount)) (helpers/merge-where [:= :amount amount])
|
||||
(seq statuses ) (helpers/merge-where [:in :status statuses])))
|
||||
|
||||
(defn get-graphql [{:keys [start sort-by asc id limit] :as args :or {limit 20}}]
|
||||
(query
|
||||
|
||||
@@ -142,9 +142,10 @@
|
||||
|
||||
|
||||
|
||||
(defn base-graphql [{:keys [imported company-id status id]}]
|
||||
(defn base-graphql [{:keys [imported company-id status id statuses]}]
|
||||
(cond-> base-query
|
||||
(limited-companies id) (helpers/merge-where [:in :company-id (limited-companies id)])
|
||||
(seq statuses ) (helpers/merge-where [:in :status statuses])
|
||||
(not (nil? imported)) (helpers/merge-where [:= :imported imported])
|
||||
(not (nil? status)) (helpers/merge-where [:= :status status])
|
||||
(not (nil? company-id)) (helpers/merge-where [:= :company-id company-id])))
|
||||
@@ -152,6 +153,7 @@
|
||||
(defn get-graphql [{:keys [start sort-by asc limit] :as args :or {limit 20}}]
|
||||
(query
|
||||
(cond-> (base-graphql args)
|
||||
|
||||
true (add-sort-by sort-by asc)
|
||||
true (assoc :limit limit)
|
||||
start (assoc :offset start))))
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
:check_number {:type 'Int}
|
||||
:name {:type 'String}
|
||||
:bank_code {:type 'String}
|
||||
:bank_name {:type 'String}}}
|
||||
:bank_name {:type 'String}
|
||||
:yodlee_account_id {:type 'Int}}}
|
||||
:address
|
||||
{:fields {:street1 {:type 'String}
|
||||
:street2 {:type 'String}
|
||||
@@ -130,6 +131,8 @@
|
||||
:status {:type 'String}
|
||||
:client {:type :client}
|
||||
:payment {:type :payment}
|
||||
:bank_account {:type :bank_account
|
||||
:resolve :bank-account-for-check}
|
||||
:date {:type 'String}
|
||||
:post_date {:type 'String}}}
|
||||
:invoice_payment
|
||||
@@ -167,6 +170,7 @@
|
||||
:total {:type 'String}
|
||||
:outstanding_balance {:type 'String}
|
||||
:invoice_number {:type 'String}
|
||||
:status {:type 'String}
|
||||
:expense_accounts {:type '(list :invoices_expense_accounts)}
|
||||
:date {:type 'String}
|
||||
:company_id {:type 'Int}
|
||||
@@ -216,12 +220,14 @@
|
||||
|
||||
:all_invoices {:type '(list :invoice)
|
||||
:args {:client_id {:type 'String}
|
||||
:original_id {:type 'Int}}
|
||||
:original_id {:type 'Int}
|
||||
:statuses {:type '(list String)}}
|
||||
:resolve :get-all-invoices}
|
||||
|
||||
:all_payments {:type '(list :payment)
|
||||
:args {:client_id {:type 'String}
|
||||
:original_id {:type 'Int}}
|
||||
:original_id {:type 'Int}
|
||||
:statuses {:type '(list String)}}
|
||||
:resolve :get-all-payments}
|
||||
|
||||
:transaction_page {:type '(list :transaction_page)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
(let [query [[:all_invoices
|
||||
{:client-id (query-params "client")
|
||||
:original-id (query-params "original")}
|
||||
[:id :total :outstanding-balance :invoice-number :date
|
||||
[:id :total :outstanding-balance :invoice-number :date :status
|
||||
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :number :bank-name :bank-code]]]]]]
|
||||
[:vendor [:name :id [:primary_contact [:name]] [:address [:street1 :city :state :zip]]]]
|
||||
[:expense_accounts [:amount :id :expense_account_id :location
|
||||
@@ -43,7 +43,7 @@
|
||||
(let [query [[:all_payments
|
||||
{:client-id (query-params "client")
|
||||
:original-id (query-params "original")}
|
||||
[:id :check-number :amount :memo :date
|
||||
[:id :check-number :amount :memo :date :status
|
||||
[:invoices [[:invoice [:id]] :amount]]
|
||||
[:bank-account [:number :bank-name :bank-code :id]]
|
||||
[:vendor [:name :id [:primary-contact [:name :email :phone]] :default-expense-account [:address [:street1 :city :state :zip]]]]
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
(defn manual-import [manual-transactions company-id]
|
||||
(let [transformed-transactions (->> manual-transactions
|
||||
(filter #(= "posted" (:status %)))
|
||||
(group-by #(select-keys % [:date :original-description :amount]))
|
||||
(group-by #(select-keys % [:date :description-original :amount]))
|
||||
|
||||
(vals)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user