Skip to content
Snippets Groups Projects
Commit b27a2736 authored by Cam Saul's avatar Cam Saul
Browse files

rewrite QS endpoint that wasn't using defendpoint

parent f3a121bb
No related branches found
No related tags found
No related merge requests found
......@@ -33,15 +33,15 @@
(build-response query-execution)))
(def query-result-csv
(GET "/:uuid/csv" [uuid]
(let-404 [{:keys [result_data] :as query-execution} (eval `(sel :one ~all-fields :uuid ~uuid))]
{:status 200
:body (with-out-str (csv/write-csv *out* (into [(:columns result_data)] (:rows result_data))))
:headers {"Content-Type" "text/csv", "Content-Disposition" (str "attachment; filename=\"query_result_" (now-iso8601) ".csv\"")}})))
(define-routes query-result-csv)
(defendpoint GET "/:uuid/csv" [uuid]
(let-404 [{{:keys [columns rows]} :result_data} (sel :one all-fields :uuid uuid)]
{:status 200
:body (with-out-str
(csv/write-csv *out* (into [columns] rows)))
:headers {"Content-Type" "text/csv"
"Content-Disposition" (str "attachment; filename=\"query_result_" (now-iso8601) ".csv\"")}}))
(define-routes)
;; ===============================================================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment