diff --git a/src/clj/auto_ap/square/core.clj b/src/clj/auto_ap/square/core.clj index 39709e5d..3ae4359f 100644 --- a/src/clj/auto_ap/square/core.clj +++ b/src/clj/auto_ap/square/core.clj @@ -458,17 +458,24 @@ {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) (defn get-square-clients - ([] (get-square-clients nil)) - ([code] + ([] (d/q '[:find [(pull ?c [:db/id :client/code :client/square-auth-token {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) ...] - :in $ ?code + :in $ + :where [?c :client/square-auth-token]] + (d/db conn))) + ([ & codes] + (d/q '[:find [(pull ?c [:db/id + :client/code + :client/square-auth-token + {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) ...] + :in $ [?code ...] :where [?c :client/square-auth-token] [?c :client/code ?code]] (d/db conn) - code))) + codes))) (defn upsert-locations ([] (doseq [client (get-square-clients)]