(ns auto-ap.graphql.transactions
  (:require [auto-ap.graphql.utils :refer [->graphql <-graphql]]
            [auto-ap.datomic.transactions :as d-transactions]
            [com.walmartlabs.lacinia :refer [execute]]
            [com.walmartlabs.lacinia.executor :as executor]
            [com.walmartlabs.lacinia.resolve :as resolve]
            [auto-ap.utils :refer [by]]
            [auto-ap.time :refer [parse normal-date]]))

(defn get-transaction-page [context args value]
  (let [args (assoc args :id (:id context))
        [transactions transactions-count] (d-transactions/get-graphql (<-graphql args))
        transactions (map ->graphql transactions)]
    [{:transactions transactions
      :total transactions-count
      :count (count transactions)
      :start (:start args 0)
      :end (+ (:start args 0) (count transactions))}]))




