Updating to include extra fields.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
(def default-read '(pull ?e [*
|
(def default-read '(pull ?e [*
|
||||||
{:invoice-payment/_payment [* {:invoice-payment/invoice [*]}]}
|
{:invoice-payment/_payment [* {:invoice-payment/invoice [*]}]}
|
||||||
{:payment/client [:client/name :db/id]}
|
{:payment/client [:client/name :db/id :client/code]}
|
||||||
{:payment/bank-account [*]}
|
{:payment/bank-account [*]}
|
||||||
{:payment/vendor [:vendor/name :vendor/default-expense-account :db/id {:vendor/primary-contact [*]} {:vendor/address [*]}]}
|
{:payment/vendor [:vendor/name :vendor/default-expense-account :db/id {:vendor/primary-contact [*]} {:vendor/address [*]}]}
|
||||||
{:payment/status [:db/ident]}
|
{:payment/status [:db/ident]}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
(reduce #(update-in %1 [:query :where] conj %2) query rest)))
|
(reduce #(update-in %1 [:query :where] conj %2) query rest)))
|
||||||
|
|
||||||
(def default-read '(pull ?e [*
|
(def default-read '(pull ?e [*
|
||||||
{:invoice/client [:client/name :db/id :client/locations]}
|
{:invoice/client [:client/name :db/id :client/locations :client/code]}
|
||||||
{:invoice/vendor [* {:vendor/address [*]}]}
|
{:invoice/vendor [* {:vendor/address [*]}]}
|
||||||
{:invoice/status [:db/ident]}
|
{:invoice/status [:db/ident]}
|
||||||
{:invoice-payment/_invoice [* {:invoice-payment/payment [* {:payment/status [*]}
|
{:invoice-payment/_invoice [* {:invoice-payment/payment [* {:payment/status [*]}
|
||||||
|
|||||||
@@ -112,8 +112,8 @@
|
|||||||
true (apply-pagination args))))
|
true (apply-pagination args))))
|
||||||
|
|
||||||
(defn graphql-results [ids db args]
|
(defn graphql-results [ids db args]
|
||||||
(->> (d/pull-many db '[* {:transaction/client [:client/name :db/id]
|
(->> (d/pull-many db '[* {:transaction/client [:client/name :db/id :client/code]
|
||||||
:transaction/bank-account [:bank-account/name :bank-account/yodlee-account-id :db/id]}]
|
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]}]
|
||||||
ids)
|
ids)
|
||||||
(map #(update % :transaction/date c/from-date))
|
(map #(update % :transaction/date c/from-date))
|
||||||
(map #(update % :transaction/post-date c/from-date))
|
(map #(update % :transaction/post-date c/from-date))
|
||||||
|
|||||||
@@ -161,6 +161,7 @@
|
|||||||
|
|
||||||
:invoice
|
:invoice
|
||||||
{:fields {:id {:type :id}
|
{:fields {:id {:type :id}
|
||||||
|
:original_id {:type 'Int}
|
||||||
:total {:type 'String}
|
:total {:type 'String}
|
||||||
:outstanding_balance {:type 'String}
|
:outstanding_balance {:type 'String}
|
||||||
:invoice_number {:type 'String}
|
:invoice_number {:type 'String}
|
||||||
@@ -424,7 +425,7 @@
|
|||||||
(map
|
(map
|
||||||
->graphql
|
->graphql
|
||||||
(d-checks/get-graphql (assoc (<-graphql args)
|
(d-checks/get-graphql (assoc (<-graphql args)
|
||||||
:limit Integer/MAX_VALUE))))
|
:count Integer/MAX_VALUE))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
(map
|
(map
|
||||||
->graphql
|
->graphql
|
||||||
(d-invoices/get-graphql (assoc (<-graphql args)
|
(d-invoices/get-graphql (assoc (<-graphql args)
|
||||||
:limit Integer/MAX_VALUE))))
|
:count Integer/MAX_VALUE))))
|
||||||
|
|
||||||
(defn add-invoice [context {{:keys [total invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
(defn add-invoice [context {{:keys [total invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
||||||
(when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice_number
|
(when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice_number
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
(let [query [[:all_invoices
|
(let [query [[:all_invoices
|
||||||
{:client-code (query-params "client-code")
|
{:client-code (query-params "client-code")
|
||||||
:original-id (query-params "original")}
|
:original-id (query-params "original")}
|
||||||
[:id :total :outstanding-balance :invoice-number :date :status
|
[:id :total :outstanding-balance :invoice-number :date :status :original-id
|
||||||
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :name :number :bank-name :bank-code]]]]]]
|
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :name :number :bank-name :bank-code]]]]]]
|
||||||
[:vendor [:name :id [:primary_contact [:name]] [:address [:street1 :city :state :zip]]]]
|
[:vendor [:name :id [:primary_contact [:name]] [:address [:street1 :city :state :zip]]]]
|
||||||
[:expense_accounts [:amount :id :expense_account_id :location
|
[:expense_accounts [:amount :id :expense_account_id :location
|
||||||
[:expense_account [:id :name [:parent [:id :name]]]]]]
|
[:expense_account [:id :name [:parent [:id :name]]]]]]
|
||||||
[:client [:name :id :locations]]]]]
|
[:client [:name :id :code :locations]]]]]
|
||||||
invoices (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
invoices (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||||
|
|
||||||
(doto (list (:all-invoices (:data invoices))) clojure.pprint/pprint)))
|
(doto (list (:all-invoices (:data invoices))) clojure.pprint/pprint)))
|
||||||
@@ -38,10 +38,10 @@
|
|||||||
{:client-code (query-params "client-code")
|
{:client-code (query-params "client-code")
|
||||||
:original-id (query-params "original")}
|
:original-id (query-params "original")}
|
||||||
[:id :check-number :amount :memo :date :status :type
|
[:id :check-number :amount :memo :date :status :type
|
||||||
[:invoices [[:invoice [:id]] :amount]]
|
[:invoices [[:invoice [:id :original-id]] :amount]]
|
||||||
[:bank-account [:number :bank-name :bank-code :id]]
|
[:bank-account [:number :code :bank-name :bank-code :id]]
|
||||||
[:vendor [:name :id [:primary-contact [:name :email :phone]] :default-expense-account [:address [:street1 :city :state :zip]]]]
|
[:vendor [:name :id [:primary-contact [:name :email :phone]] :default-expense-account [:address [:street1 :city :state :zip]]]]
|
||||||
[:client [:id :name]]
|
[:client [:id :name :code]]
|
||||||
]]]
|
]]]
|
||||||
payments (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
payments (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||||
(list (:all-payments (:data payments)))))
|
(list (:all-payments (:data payments)))))
|
||||||
|
|||||||
Reference in New Issue
Block a user