Adds completely arbitrary queries
This commit is contained in:
@@ -1345,13 +1345,10 @@
|
||||
([id q]
|
||||
(query id q nil ))
|
||||
([id q v]
|
||||
|
||||
(lc/with-context {:query q}
|
||||
(log/info "Executing query" q)
|
||||
|
||||
(try
|
||||
(let [[result time] (time-it (simplify (execute schema q v {:id id})))]
|
||||
|
||||
(info-event "Query completed"
|
||||
{:time (:time time)
|
||||
:errors (seq (:errors result))})
|
||||
@@ -1360,7 +1357,6 @@
|
||||
result)
|
||||
|
||||
(catch Exception e
|
||||
|
||||
(if-let [v (or (:validation-error (ex-data e))
|
||||
(:validation-error (ex-data (.getCause e)))
|
||||
)]
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
[auto-ap.graphql :as graphql]
|
||||
[auto-ap.graphql.utils :refer [->graphql <-graphql assert-admin]]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[clojure.tools.logging :as log]
|
||||
[clj-time.coerce :as coerce :refer [to-date]]
|
||||
[clj-time.core :as time]
|
||||
[compojure.core :refer [context defroutes GET wrap-routes]]
|
||||
@@ -200,7 +201,12 @@
|
||||
:approval_status (:transaction/approval-status e)
|
||||
:bank_account {:name (:bank-account/name bank-account)
|
||||
:code (:bank-account/code bank-account)
|
||||
:id (:db/id bank-account)}})))))))
|
||||
:id (:db/id bank-account)}}))))))
|
||||
|
||||
(GET "/raw" {:keys [query-params identity]}
|
||||
(assert-admin identity)
|
||||
(log/info "Executing raw query " (get query-params "query" ))
|
||||
(into (list) (apply d/q (clojure.edn/read-string (get query-params "query" )) (into [(d/db conn)] (clojure.edn/read-string (get query-params "args" "[]")))))))
|
||||
|
||||
|
||||
wrap-secure)
|
||||
|
||||
Reference in New Issue
Block a user