SP
Size: a a a
SP
SP
SP
SP
ST
(cond-> payload
(= "UNKNOWN99" (get-in payload [:data :accountingCustomerParty :endpoint]))
(update-in [:processingPreference :sendTo] assoc :id "UNKNOWN99"))
SP
SP
SP
SP
ST
(let [payload {:data {:accountingCustomerParty {:endpoint "UNKNOWN99"}}}]
(cond-> payload
(= "UNKNOWN99" (get-in payload [:data :accountingCustomerParty :endpoint]))
(update-in [:processingPreference :sendTo] assoc :id "UNKNOWN99")))
=>
{:data {:accountingCustomerParty {:endpoint "UNKNOWN99"}},
:processingPreference {:sendTo {:id "UNKNOWN99"}}}
SP
ST
ST
(let [payload {:data {:accountingCustomerParty {:endpoint {:schemeId "email"}}}}
endpoint-path [:data :accountingCustomerParty :endpoint]
send-to-path [:processingPreference :sendTo]]
(cond-> payload
(= "email" (get-in payload (conj endpoint-path :schemeId)))
(-> (update-in endpoint-path assoc :id "UNKNOWN")
(update-in send-to-path assoc :id "UNKNOWN"))))
=>
{:data {:accountingCustomerParty {:endpoint {:schemeId "email", :id "UNKNOWN"}}},
:processingPreference {:sendTo {:id "UNKNOWN"}}}
DL
(let [payload {:data {:accountingCustomerParty
{:endpoint
{:schemeId "email"}}}}
endpoint-path [:data :accountingCustomerParty :endpoint]
send-to-path [:processingPreference :sendTo]
email? (= "email" (get-in payload (conj endpoint-path :schemeId)))
updater #(if email? "UNKNOWN" %)]
(-> payload
(update-in endpoint-path updater)
(update-in send-to-path updater)))
DF
D
(defn get-list-by-query
[connection opts filter sort]
(let [db (get-db-from-connection connection)
collection (get opts :collection nil )
skip (get opts :skip 0)
limit (get opts :limit 10)]
(if (nil? collection)
(throw (Exception. "Not send query options"))
(mq/with-collection
db
collection
(mq/find (if (nil? filter) {} filter))
(mq/skip skip)
(mq/limit limit)))))
D
DF