(ns auto-ap.graphql.sales-orders
  (:require [auto-ap.datomic.sales-orders :as d-sales-orders2]
            [auto-ap.graphql.utils :refer [->graphql <-graphql result->page]]))

(defn get-sales-orders-page [context args value]
  (let [args (assoc args :id (:id context))
        [sales-orders sales-orders-count {:keys [total tax]}] (d-sales-orders2/get-graphql  (<-graphql args))]
    (assoc (result->page sales-orders sales-orders-count :sales_orders args)
           :sales_order_total total
           :sales_order_tax tax)))
