more viewing from UI.

This commit is contained in:
Bryce Covert
2018-08-10 22:52:53 -07:00
parent cbbabb2219
commit b5ab860315
6 changed files with 39 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
[auto-ap.datomic :refer [uri]]))
(defn get-all []
(->> (d/q '[:find (pull ?e [*])
:where [?e :client/name]]
(d/db (d/connect uri)))

View File

@@ -0,0 +1,16 @@
(ns auto-ap.datomic.vendors
(:require [datomic.api :as d]
[auto-ap.datomic :refer [uri]]))
(defn get-all []
(->> (d/q '[:find (pull ?e [*])
:where [?e :vendor/name]]
(d/db (d/connect uri)))
(map first)
#_(map (fn [c]
(update c :client/bank-accounts
(fn [bas]
(map (fn [ba]
(update ba :bank-account/type :db/ident ))
bas)))))))

View File

@@ -12,6 +12,7 @@
[auto-ap.db.vendors :as vendors]
[auto-ap.db.companies :as companies]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.db.users :as users]
[auto-ap.db.checks :as checks]
[auto-ap.routes.checks :as rchecks]
@@ -40,6 +41,11 @@
:address {:type :address}
:locations {:type '(list String)}
:bank_accounts {:type '(list :bank_account)}}}
:contact
{:fields {:id {:type 'String}
:name {:type 'String}
:email {:type 'String}
:phone {:type 'String}}}
:bank_account
{:fields {:id {:type 'String}
@@ -56,20 +62,14 @@
:state {:type 'String}
:zip {:type 'String}}}
:vendor
{:fields {:id {:type 'Int}
{:fields {:id {:type 'String}
:name {:type 'String}
:code {:type 'String}
:print_as {:type 'String}
:primary_contact {:type 'String}
:primary_contact {:type :contact}
:secondary_contact {:type :contact}
:address {:type :address}
:primary_email {:type 'String}
:primary_phone {:type 'String}
:secondary_contact {:type 'String}
:secondary_email {:type 'String}
:secondary_phone {:type 'String}
:default_expense_account {:type 'Int}
:invoice_reminder_schedule {:type 'String}}}
@@ -453,10 +453,9 @@
(defn get-company [context args value]
(println "GETTING COMPANY" (:id context))
(doto (->graphql
(filter #(can-see-company? (:id context) %)
(d-clients/get-all)))
println))
(->graphql
(filter #(can-see-company? (:id context) %)
(d-clients/get-all))))
(defn join-companies [users]
(let [companies (by :id (companies/get-all))]
@@ -478,7 +477,7 @@
(defn get-vendor [context args value]
(->graphql
(vendors/get-all)))
(d-vendors/get-all)))
(defn print-checks [context args value]
@@ -555,4 +554,4 @@
(query id q nil ))
([id q v]
(println "executing graphql query" id q v)
(simplify (execute schema q v {:id id}))))
(time (simplify (execute schema q v {:id id})))))