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