Skip to content

Commit

Permalink
migration
Browse files Browse the repository at this point in the history
  • Loading branch information
macielti committed Jul 21, 2024
1 parent c039efa commit 7a7cf49
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
[com.datomic/datomic-free "0.9.5697"]
[com.stuartsierra/component "1.1.0"]
[siili/humanize "0.1.1"]
[prismatic/plumbing "0.6.0"]
[camel-snake-kebab "0.4.3"]
[prismatic/schema "1.4.1"]
[buddy/buddy-sign "3.5.351"]
Expand All @@ -53,7 +52,8 @@
[clj-commons/iapetos "0.1.14"]
[clojure.java-time "1.4.2"]
[clj-rate-limiter "0.1.6-RC1"]
[com.github.liquidz/antq "RELEASE"]]
[com.github.liquidz/antq "RELEASE"]
[dev.weavejester/medley "1.8.0"]]

:injections [(require 'hashp.core)]

Expand Down
12 changes: 6 additions & 6 deletions src/common_clj/component/kafka/consumer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[common-clj.traceability.core :as common-traceability]
[io.pedestal.interceptor :as interceptor]
[io.pedestal.interceptor.chain :as chain]
[medley.core :as medley]
[overtone.at-at :as at-at]
[plumbing.core :as plumbing]
[schema.core :as s]
[taoensso.timbre :as timbre])
(:import (java.time Duration)
Expand Down Expand Up @@ -77,10 +77,10 @@
"key.deserializer" StringDeserializer
"bootstrap.servers" (get-in config [:config :bootstrap-server])
"group.id" (get-in config [:config :service-name])}
components (plumbing/assoc-when {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
components (medley/assoc-some {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
topics (get-in config [:config :topics])
context {:consumer-props consumer-props
:topics topics
Expand Down Expand Up @@ -124,7 +124,7 @@
(when-not (:producer producer)
(throw (ex-info "MockKafkaConsumer depends on MockKafkaProducer"
{:error :mock-kafka-producer-component-not-provided})))
(let [components (plumbing/assoc-when {}
(let [components (medley/assoc-some {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
Expand Down
14 changes: 7 additions & 7 deletions src/common_clj/component/rabbitmq/consumer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[langohr.core :as rmq]
[langohr.queue :as lq]
[langohr.consumers :as lc]
[plumbing.core :as plumbing]
[medley.core :as medley]
[schema.core :as s]
[taoensso.timbre :as log]
[common-clj.component.rabbitmq.producer :as component.rabbitmq.producer])
Expand All @@ -23,12 +23,12 @@
uri (-> config-content :rabbitmq-uri)
connection (rmq/connect {:uri uri})
channel (lch/open connection)
components (plumbing/assoc-when {:config (:config config)}
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client))
components (medley/assoc-some {:config (:config config)}
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client))
service-name (:service-name config-content)]

(s/validate Consumers consumers)
Expand Down
22 changes: 11 additions & 11 deletions src/common_clj/component/service.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require [com.stuartsierra.component :as component]
[common-clj.io.interceptors :as io.interceptors]
[io.pedestal.http :as http]
[plumbing.core :as plumbing]))
[medley.core :as medley]))

(defrecord Service [routes config datomic datalevin postgresql rabbitmq-producer producer http-client prometheus rate-limiter telegram-producer]
component/Lifecycle
Expand All @@ -14,16 +14,16 @@
::http/port port
::http/type :jetty
::http/join? false}
components (plumbing/assoc-when {:config (:config config)}
:producer (:producer producer)
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client)
:prometheus (:prometheus prometheus)
:rate-limiter (:rate-limiter rate-limiter)
:telegram-producer (:telegram-producer telegram-producer))]
components (medley/assoc-some {:config (:config config)}
:producer (:producer producer)
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client)
:prometheus (:prometheus prometheus)
:rate-limiter (:rate-limiter rate-limiter)
:telegram-producer (:telegram-producer telegram-producer))]
(assoc component :service (http/start (-> service-map
http/default-interceptors
(update ::http/interceptors concat (io.interceptors/common-interceptors
Expand Down
8 changes: 4 additions & 4 deletions src/common_clj/io/interceptors/auth.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(ns common-clj.io.interceptors.auth
(:require [schema.core :as s]
(:require [medley.core :as medley]
[schema.core :as s]
[cheshire.core :as json]
[io.pedestal.interceptor :as pedestal.interceptor]
[common-clj.error.core :as common-error]
[clj-http.client :as client]
[common-clj.schema.core :as common-schema]
[plumbing.core :as plumbing]
[taoensso.timbre :as log]))

(s/defschema GoogleRecaptchaV3ResponseTokenValidationResultWireIn
Expand All @@ -18,8 +18,8 @@

(s/defn wire->google-recaptcha-v3-response-token-validation-result :- GoogleRecaptchaV3ResponseTokenValidationResult
[{:keys [success score]} :- GoogleRecaptchaV3ResponseTokenValidationResultWireIn]
(plumbing/assoc-when {:validation-result/success success}
:validation-result/score score))
(medley/assoc-some {:validation-result/success success}
:validation-result/score score))


(s/defn ^:private validate-recaptcha-v3-token! :- GoogleRecaptchaV3ResponseTokenValidationResult
Expand Down

0 comments on commit 7a7cf49

Please sign in to comment.