started making graphql do the right thing.

This commit is contained in:
Bryce Covert
2018-08-10 22:36:37 -07:00
parent 8ebd3da0c7
commit cbbabb2219
4 changed files with 28 additions and 10 deletions

View File

@@ -11,6 +11,7 @@
[auto-ap.graphql.utils :refer [assert-admin can-see-company? assert-can-see-company]]
[auto-ap.db.vendors :as vendors]
[auto-ap.db.companies :as companies]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.db.users :as users]
[auto-ap.db.checks :as checks]
[auto-ap.routes.checks :as rchecks]
@@ -33,7 +34,7 @@
:objects
{
:company
{:fields {:id {:type 'Int}
{:fields {:id {:type 'String}
:name {:type 'String}
:email {:type 'String}
:address {:type :address}
@@ -41,7 +42,7 @@
:bank_accounts {:type '(list :bank_account)}}}
:bank_account
{:fields {:id {:type 'Int}
{:fields {:id {:type 'String}
:type {:type 'String}
:number {:type 'String}
:check_number {:type 'Int}
@@ -451,9 +452,11 @@
(defn get-company [context args value]
(->graphql
(filter #(can-see-company? (:id context) %)
(companies/get-all))))
(println "GETTING COMPANY" (:id context))
(doto (->graphql
(filter #(can-see-company? (:id context) %)
(d-clients/get-all)))
println))
(defn join-companies [users]
(let [companies (by :id (companies/get-all))]