editing clients has started.
This commit is contained in:
@@ -117,6 +117,10 @@
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A client's human-friendly name"}
|
||||
{:db/ident :client/email
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "hello@example.com"}
|
||||
{:db/ident :client/code
|
||||
:db/valueType :db.type/string
|
||||
:db/unique :db.unique/identity
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
(defn get-all []
|
||||
|
||||
(->> (d/q '[:find (pull ?e [*])
|
||||
(->> (d/q '[:find (pull ?e [* {:client/address [*]}])
|
||||
:where [?e :client/name]]
|
||||
(d/db (d/connect uri)))
|
||||
(map first)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.graphql.users :as gq-users]
|
||||
[auto-ap.graphql.clients :as gq-clients]
|
||||
[auto-ap.graphql.vendors :as gq-vendors]
|
||||
[auto-ap.graphql.checks :as gq-checks]
|
||||
[auto-ap.graphql.expense-accounts :as expense-accounts]
|
||||
@@ -245,6 +246,21 @@
|
||||
:invoice_payment_amount {:fields {:invoice_id {:type :id}
|
||||
:amount {:type 'Float}}}
|
||||
|
||||
:edit_client {:fields {:id {:type :id}
|
||||
:name {:type 'String}
|
||||
:email {:type 'String}
|
||||
:address {:type :add_address}
|
||||
:locations {:type '(list String)}
|
||||
:bank_accounts {:type '(list :edit_bank_account)}}}
|
||||
:edit_bank_account
|
||||
{:fields {:id {:type :id }
|
||||
:type {:type :bank_account_type}
|
||||
:number {:type 'String}
|
||||
:check_number {:type 'Int}
|
||||
:name {:type 'String}
|
||||
:bank_code {:type 'String}
|
||||
:bank_name {:type 'String}
|
||||
:yodlee_account_id {:type 'Int}}}
|
||||
:edit_user
|
||||
{:fields {:id {:type :id}
|
||||
:name {:type 'String}
|
||||
@@ -322,6 +338,10 @@
|
||||
:args {:edit_user {:type :edit_user}}
|
||||
:resolve :mutation/edit-user}
|
||||
|
||||
:edit_client {:type :client
|
||||
:args {:edit_client {:type :edit_client}}
|
||||
:resolve :mutation/edit-client}
|
||||
|
||||
:upsert_vendor {:type :vendor
|
||||
:args {:vendor {:type :add_vendor}}
|
||||
:resolve :mutation/upsert-vendor}
|
||||
@@ -392,10 +412,7 @@
|
||||
:limit Integer/MAX_VALUE))))
|
||||
|
||||
|
||||
(defn get-client [context args value]
|
||||
(->graphql
|
||||
(filter #(can-see-client? (:id context) %)
|
||||
(d-clients/get-all))))
|
||||
|
||||
|
||||
(defn get-user [context args value]
|
||||
(assert-admin (:id context))
|
||||
@@ -429,13 +446,14 @@
|
||||
:get-payment-page gq-checks/get-payment-page
|
||||
:get-transaction-page gq-transactions/get-transaction-page
|
||||
|
||||
:get-client get-client
|
||||
:get-client gq-clients/get-client
|
||||
:get-user get-user
|
||||
:mutation/add-handwritten-check gq-checks/add-handwritten-check
|
||||
:mutation/print-checks print-checks
|
||||
:mutation/edit-user gq-users/edit-user
|
||||
:mutation/add-invoice gq-invoices/add-invoice
|
||||
:mutation/edit-invoice gq-invoices/edit-invoice
|
||||
:mutation/edit-client gq-clients/edit-client
|
||||
:mutation/upsert-vendor gq-vendors/upsert-vendor
|
||||
:mutation/void-invoice gq-invoices/void-invoice
|
||||
:mutation/void-payment gq-checks/void-check
|
||||
|
||||
@@ -320,8 +320,6 @@
|
||||
base-payment (base-payment [invoice] (:invoice/vendor invoice)
|
||||
(:invoice/client invoice)
|
||||
bank-account :payment-type/check 0 {(:invoice_id args) (:amount args)})]
|
||||
|
||||
|
||||
@(d/transact (d/connect uri)
|
||||
(into [(assoc base-payment
|
||||
:payment/type :payment-type/check
|
||||
|
||||
Reference in New Issue
Block a user