fixing several issues.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user