fixing several issues.

This commit is contained in:
Bryce Covert
2019-01-18 08:10:54 -08:00
parent 775150131e
commit 72350a03c1
8 changed files with 10 additions and 7 deletions

View File

@@ -68,7 +68,7 @@
(:sort-by args) (sort-by (sort-fn args))
(= (:asc args) false) (reverse)
true (drop (:start args 0))
true (take (:count args 20)))))
true (take (:count args 100)))))
(defn count-graphql [args]
(->> (raw-graphql args)

View File

@@ -65,7 +65,7 @@
(:sort-by args) (sort-by (sort-fn args))
(= (:asc args) false) (reverse)
true (drop (:start args 0))
true (take (:count args 20)))))
true (take (:count args 100)))))
(defn count-graphql [args]

View File

@@ -46,7 +46,7 @@
(:sort-by args) (sort-by (sort-fn args))
(= (:asc args) false) (reverse)
true (drop (:start args 0))
true (take (:count args 20)))))
true (take (:count args 100)))))
(defn count-graphql [args]

View File

@@ -71,7 +71,7 @@
(:sort-by args) (sort-by (sort-fn args))
(= (:asc args) false) (reverse)
true (drop (:start args 0))
true (take (:count args 20)))))
true (take (:count args 100)))))
(defn count-graphql [args]

View File

@@ -339,7 +339,8 @@
(let [check (d-checks/get-by-id id)]
(assert (or (= :payment-status/pending (:payment/status check))
(#{:payment-type/cash :payment-type/debit} (:payment/type check))))
(assert-can-see-client (:id context) (:client-id check))
(println "VOID CHECK" check)
(assert-can-see-client (:id context) (:db/id (:payment/client check)))
(let [removing-payments (mapcat (fn [x]
(let [invoice (:invoice-payment/invoice x)
new-balance (+ (:invoice/outstanding-balance invoice)

View File

@@ -82,7 +82,7 @@
(defn void-invoice [context {id :invoice_id} value]
(let [invoice (d-invoices/get-by-id id)
_ (assert-can-see-client (:id context) (:client-id invoice))
_ (assert-can-see-client (:id context) (:db/id (:invoice/client invoice)))
updated-invoice (d-invoices/update {:db/id id
:invoice/total 0.0
:invoice/outstanding-balance 0.0

View File

@@ -48,6 +48,8 @@
(throw-unauthorized)))
(defn can-see-client? [identity client]
(when (not client)
(println "WARNING - permission checking for null client"))
(or (= "admin" (:user/role identity))
((set (map :db/id (:user/clients identity))) (:db/id client))
((set (map :db/id (:user/clients identity))) client)))

View File

@@ -47,7 +47,7 @@
[:expense_accounts [:amount :id :expense_account_id :location
[:expense_account [:id :name :location [:parent [:id :name]]]]]]
[:client [:name :id :locations]]
[:payments [:amount [:payment [:amount :s3_url :check_number ]]]]
[:payments [:amount :id [:payment [:id :amount :s3_url :check_number ]]]]
]]
:total
:start