side panel work.

This commit is contained in:
BC
2019-01-29 17:33:27 -08:00
parent 327e51658c
commit 684c5343ac
4 changed files with 35 additions and 19 deletions

View File

@@ -29,7 +29,7 @@
(def integreat-schema
{
:scalars {:id {
:parse (schema/as-conformer #(Long/parseLong %))
:parse (schema/as-conformer #(when % (Long/parseLong %)))
:serialize (schema/as-conformer #(.toString %))}
:ident {:parse (schema/as-conformer (fn [x] {:db/ident x}))
:serialize (schema/as-conformer #(or (:ident %) (:db/ident %) %))}}
@@ -53,6 +53,7 @@
{:fields {:id {:type :id }
:type {:type :bank_account_type}
:number {:type 'String}
:routing {:type 'String}
:code {:type 'String}
:check_number {:type 'Int}
:name {:type 'String}

View File

@@ -12,15 +12,9 @@
(defn edit-client [context {:keys [edit_client new_bank_accounts] :as args} value]
(assert-admin (:id context))
(let [client (d-clients/get-by-id (:id edit_client))
#_#_new-clients (set (map #(Long/parseLong %) (:clients edit_user)))
#_#_clients-to-remove (->> (:user/clients user)
(map :db/id)
(filter #(not (new-clients %)) ))]
@(d/transact (d/connect uri)
(doto (-> [(remove-nils {:db/id (:db/id client)
(let [client (when (:id edit_client) (d-clients/get-by-id (:id edit_client)))
id (or (:db/id client) "new-client")
transactions [(remove-nils {:db/id id
:client/code (if (str/blank? (:client/code client))
(:code edit_client)
(:client/code client))
@@ -51,12 +45,8 @@
) (:bank_accounts edit_client))
})]
#_(into (map (fn [c] [:db/retract (:db/id user) :user/clients c]) clients-to-remove)))
clojure.pprint/pprint))
(doto (->graphql
(d-clients/get-by-id (:id edit_client)))
println)))
result @(d/transact (d/connect uri) transactions)]
(-> result :tempids (get id) d-clients/get-by-id ->graphql)))
(defn get-client [context args value]