Adds the ability to set up read only users, adds linking filtering

This commit is contained in:
2024-01-03 21:42:30 -08:00
parent 48f70ef93d
commit 810c3aacb2
10 changed files with 192 additions and 63 deletions

View File

@@ -40,6 +40,7 @@
(defn raw-graphql-ids
([args] (raw-graphql-ids (dc/db conn) args))
([db args]
(auto-ap.logging/peek args)
(let [valid-clients (extract-client-ids (:clients args)
(:client-id args)
(when (:client-code args)
@@ -104,6 +105,20 @@
:where ['[?e :transaction/approval-status ?approval-status]]}
:args [(:approval-status args)]})
(= (:linked-to args) :payment)
(merge-query {:query {:where ['[?e :transaction/payment]]}})
(= (:linked-to args) :expected-deposit)
(merge-query {:query {:where ['[?e :transaction/expected-deposit]]}})
(= (:linked-to args) :invoice)
(merge-query {:query {:where ['[?e :transaction/payment ?p]
'[_ :invoice-payment/payment ?p]]}})
(= (:linked-to args) :none)
(merge-query {:query {:where ['(not [?e :transaction/payment])
'(not [?e :transaction/expected-deposit])]}})
(:original-id args)
(merge-query {:query {:in ['?original-id]
:where ['[?e :transaction/client ?c]

View File

@@ -663,6 +663,7 @@
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}
:approval_status {:type :transaction_approval_status}
:linked_to {:type :transaction_link_type}
:unresolved {:type 'Boolean}}}
:edit_transaction
{:fields {:id {:type :id}
@@ -676,21 +677,25 @@
{:enum-value :unapproved}
{:enum-value :suppressed}
{:enum-value :requires_feedback}
{:enum-value :excluded}]}})
{:enum-value :excluded}]}
:transaction_link_type {:values [{:enum-value :none}
{:enum-value :expected_deposit}
{:enum-value :payment}
{:enum-value :invoice}]}})
(def resolvers
{:get-transaction-page get-transaction-page
:get-potential-autopay-invoices-matches get-potential-autopay-invoices-matches
:get-potential-unpaid-invoices-matches get-potential-unpaid-invoices-matches
:mutation/edit-transaction edit-transaction
:mutation/unlink-transaction unlink-transaction
:mutation/bulk-change-transaction-status bulk-change-status
:mutation/delete-transactions delete-transactions
:mutation/bulk-code-transactions bulk-code-transactions
:mutation/match-transaction match-transaction
{:get-transaction-page get-transaction-page
:get-potential-autopay-invoices-matches get-potential-autopay-invoices-matches
:get-potential-unpaid-invoices-matches get-potential-unpaid-invoices-matches
:mutation/edit-transaction edit-transaction
:mutation/unlink-transaction unlink-transaction
:mutation/bulk-change-transaction-status bulk-change-status
:mutation/delete-transactions delete-transactions
:mutation/bulk-code-transactions bulk-code-transactions
:mutation/match-transaction match-transaction
:mutation/match-transaction-autopay-invoices match-transaction-autopay-invoices
:mutation/match-transaction-unpaid-invoices match-transaction-unpaid-invoices
:mutation/match-transaction-rules match-transaction-rules})
:mutation/match-transaction-unpaid-invoices match-transaction-unpaid-invoices
:mutation/match-transaction-rules match-transaction-rules})
(defn attach [schema]

View File

@@ -50,8 +50,8 @@
:where
[?p :payment/client ?c]
[?p :payment/date ?d ]
[(>= ?d #inst "2022-01-01T08:00")]
[(< ?d #inst "2023-01-01T08:00")]
[(>= ?d #inst "2023-01-01T08:00")]
[(< ?d #inst "2024-01-01T08:00")]
[?p :payment/type :payment-type/check]
[?p :payment/amount ?a]
[?p :payment/vendor ?v]]
@@ -69,8 +69,8 @@
:where
[?p :payment/client ?c]
[?p :payment/date ?d ]
[(>= ?d #inst "2022-01-01T08:00")]
[(< ?d #inst "2023-01-01T08:00")]
[(>= ?d #inst "2023-01-01T08:00")]
[(< ?d #inst "2024-01-01T08:00")]
[?p :payment/type :payment-type/check]
[?p :payment/amount ?a]
[?p :payment/vendor ?v]]

View File

@@ -78,6 +78,8 @@
:content "Manager"}
{:value "user"
:content "User"}
{:value "read-only"
:content "Read Only"}
{:value "none"
:content "None"}]}))
(com/field {:label "Client"}