(ns auto-ap.db.checks
  (:require [auto-ap.db.utils :refer [clj->db db->clj get-conn execute!] :as u]
            [clojure.edn :as edn]
            [clojure.java.jdbc :as j]
            [honeysql.core :as sql]
            [honeysql.helpers :as helpers]))

(def base-query (sql/build :select :*
                           :from :checks))

(defn data->fields [x]
  (-> x
      (merge (:data x))
      (dissoc :data)))

(defn query [q]
  (map data->fields (u/query q)))

(defn get-all []
  (query base-query))
