From 8c978394d76aa5d169553094bcb277cb029fcb41 Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Mon, 5 Aug 2024 22:51:00 -0300
Subject: [PATCH 1/8] feat: starting the shopping module

---
 infra/docker-compose.yml                      |  4 +-
 services/llm-client/diplomat/http_client.py   |  1 -
 .../adapters/in/shopping_initiation.clj       | 10 ---
 .../in/shopping_initiation_data_request.clj   | 11 ---
 .../adapters/out/shopping.clj                 | 14 ---
 .../adapters/out/shopping_initiation_data.clj |  9 --
 .../components/datahike.clj                   | 25 ++++++
 .../components/datomic.clj                    |  3 -
 src/purchase_listinator/components/mongo.clj  | 11 +--
 src/purchase_listinator/core.clj              |  4 +-
 .../logic/shopping_category.clj               | 10 ---
 .../models/internal/cart.clj                  |  9 --
 .../adapters/db/datomic}/shopping.clj         |  8 +-
 .../db/datomic}/shopping_category.clj         |  4 +-
 .../adapters/db/datomic}/shopping_item.clj    |  4 +-
 .../adapters/db/mongo/shopping_location.clj   |  4 +-
 .../shopping}/adapters/in/cart.clj            |  4 +-
 .../adapters/in/price_suggestion.clj          |  4 +-
 .../adapters/in/shopping_initiation.clj       | 10 +++
 .../in/shopping_initiation_data_request.clj   | 11 +++
 .../shopping/adapters/out/shopping.clj        | 14 +++
 .../adapters/out/shopping_initiation_data.clj |  9 ++
 .../modules/shopping/core.clj                 | 87 +++++++++++++++++++
 .../diplomat/db}/datomic/shopping.clj         | 22 ++---
 .../db}/datomic/shopping_category.clj         |  6 +-
 .../diplomat/db}/datomic/shopping_item.clj    |  6 +-
 .../diplomat/db}/mongo/shopping_location.clj  |  6 +-
 .../shopping/diplomat/http/client.clj}        | 10 +--
 .../shopping/diplomat/http/server.clj}        | 10 +--
 .../diplomat}/publishers/shopping.clj         |  6 +-
 .../{ => modules/shopping}/flows/shopping.clj | 51 ++++++-----
 .../{ => modules/shopping}/logic/shopping.clj | 15 ++--
 .../shopping}/logic/shopping_cart.clj         |  6 +-
 .../shopping}/logic/shopping_cart_event.clj   | 14 +--
 .../shopping/logic/shopping_category.clj      | 10 +++
 .../shopping}/logic/shopping_item.clj         |  4 +-
 .../shopping}/logic/shopping_location.clj     |  6 +-
 .../shopping_purchase_list_cart_event.clj     |  6 +-
 .../modules/shopping/schemas/models/cart.clj  |  9 ++
 .../shopping/schemas/models}/cart_events.clj  |  2 +-
 .../schemas/models}/price_suggestion.clj      |  2 +-
 .../schemas/models}/purchase_list.clj         |  2 +-
 .../shopping/schemas/models}/shopping.clj     |  4 +-
 .../schemas/models}/shopping_category.clj     |  4 +-
 .../schemas/models}/shopping_initiation.clj   |  2 +-
 .../shopping_initiation_data_request.clj      |  2 +-
 .../schemas/models}/shopping_item.clj         |  2 +-
 .../schemas/models}/shopping_list.clj         |  4 +-
 .../schemas/models}/shopping_location.clj     |  2 +-
 .../shopping/schemas}/wires/in/cart.clj       |  6 +-
 .../schemas}/wires/in/price_suggestion.clj    |  4 +-
 .../shopping/schemas}/wires/in/shopping.clj   |  2 +-
 .../shopping/schemas/wires/out/shopping.clj   | 10 +++
 .../wires/out/shopping_initiation_data.clj    |  2 +-
 .../modules/shopping_cart/core.clj            |  2 +-
 .../purchase_listinator_core.clj              | 31 ++-----
 .../wires/out/shopping.clj                    | 10 ---
 57 files changed, 319 insertions(+), 231 deletions(-)
 delete mode 100644 src/purchase_listinator/adapters/in/shopping_initiation.clj
 delete mode 100644 src/purchase_listinator/adapters/in/shopping_initiation_data_request.clj
 delete mode 100644 src/purchase_listinator/adapters/out/shopping.clj
 delete mode 100644 src/purchase_listinator/adapters/out/shopping_initiation_data.clj
 create mode 100644 src/purchase_listinator/components/datahike.clj
 delete mode 100644 src/purchase_listinator/logic/shopping_category.clj
 delete mode 100644 src/purchase_listinator/models/internal/cart.clj
 rename src/purchase_listinator/{adapters/db => modules/shopping/adapters/db/datomic}/shopping.clj (66%)
 rename src/purchase_listinator/{adapters/db => modules/shopping/adapters/db/datomic}/shopping_category.clj (81%)
 rename src/purchase_listinator/{adapters/db => modules/shopping/adapters/db/datomic}/shopping_item.clj (82%)
 rename src/purchase_listinator/{ => modules/shopping}/adapters/db/mongo/shopping_location.clj (71%)
 rename src/purchase_listinator/{ => modules/shopping}/adapters/in/cart.clj (56%)
 rename src/purchase_listinator/{ => modules/shopping}/adapters/in/price_suggestion.clj (59%)
 create mode 100644 src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
 create mode 100644 src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
 create mode 100644 src/purchase_listinator/modules/shopping/adapters/out/shopping.clj
 create mode 100644 src/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data.clj
 create mode 100644 src/purchase_listinator/modules/shopping/core.clj
 rename src/purchase_listinator/{dbs => modules/shopping/diplomat/db}/datomic/shopping.clj (70%)
 rename src/purchase_listinator/{dbs => modules/shopping/diplomat/db}/datomic/shopping_category.clj (82%)
 rename src/purchase_listinator/{dbs => modules/shopping/diplomat/db}/datomic/shopping_item.clj (85%)
 rename src/purchase_listinator/{dbs => modules/shopping/diplomat/db}/mongo/shopping_location.clj (76%)
 rename src/purchase_listinator/{endpoints/http/client/shopping.clj => modules/shopping/diplomat/http/client.clj} (86%)
 rename src/purchase_listinator/{endpoints/http/shopping.clj => modules/shopping/diplomat/http/server.clj} (83%)
 rename src/purchase_listinator/{ => modules/shopping/diplomat}/publishers/shopping.clj (63%)
 rename src/purchase_listinator/{ => modules/shopping}/flows/shopping.clj (69%)
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping.clj (77%)
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping_cart.clj (50%)
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping_cart_event.clj (93%)
 create mode 100644 src/purchase_listinator/modules/shopping/logic/shopping_category.clj
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping_item.clj (75%)
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping_location.clj (58%)
 rename src/purchase_listinator/{ => modules/shopping}/logic/shopping_purchase_list_cart_event.clj (66%)
 create mode 100644 src/purchase_listinator/modules/shopping/schemas/models/cart.clj
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/cart_events.clj (98%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/price_suggestion.clj (77%)
 rename src/purchase_listinator/{models/internal/shopping => modules/shopping/schemas/models}/purchase_list.clj (90%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping.clj (75%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_category.clj (62%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_initiation.clj (77%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_initiation_data_request.clj (72%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_item.clj (82%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_list.clj (85%)
 rename src/purchase_listinator/{models/internal => modules/shopping/schemas/models}/shopping_location.clj (73%)
 rename src/purchase_listinator/{ => modules/shopping/schemas}/wires/in/cart.clj (82%)
 rename src/purchase_listinator/{ => modules/shopping/schemas}/wires/in/price_suggestion.clj (53%)
 rename src/purchase_listinator/{ => modules/shopping/schemas}/wires/in/shopping.clj (87%)
 create mode 100644 src/purchase_listinator/modules/shopping/schemas/wires/out/shopping.clj
 rename src/purchase_listinator/{ => modules/shopping/schemas}/wires/out/shopping_initiation_data.clj (68%)
 delete mode 100644 src/purchase_listinator/wires/out/shopping.clj

diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml
index a9ba059..ab35f35 100644
--- a/infra/docker-compose.yml
+++ b/infra/docker-compose.yml
@@ -3,7 +3,7 @@ services:
   purchase_listinator_server:
     container_name: purchase_listinator_server
     restart: always
-    image: gumberss/purchase-listinator:v2
+    image: gumberss/purchase-listinator:v3
     ports:
       - "3000:3000"
     volumes:
@@ -14,7 +14,7 @@ services:
       - rabbitmq
     environment:
       - DATAHIKE_PATH=/usr/purchaselistinator/database
-      - REDIS_HOST=redis
+      - SHOPPING_CART_REDIS_HOST=redis
       - MONGODB_HOST=mongodb
       - RABBITMQ_HOST=rabbitmq
       - ENVIRONMENT_TYPE=prod
diff --git a/services/llm-client/diplomat/http_client.py b/services/llm-client/diplomat/http_client.py
index eb77c15..21296d0 100644
--- a/services/llm-client/diplomat/http_client.py
+++ b/services/llm-client/diplomat/http_client.py
@@ -8,7 +8,6 @@
 )
 
 def complete(rendered_prompt : RenderedPrompt):
-
     images = [{
         "type": "image_url",
         "image_url": {
diff --git a/src/purchase_listinator/adapters/in/shopping_initiation.clj b/src/purchase_listinator/adapters/in/shopping_initiation.clj
deleted file mode 100644
index 220a061..0000000
--- a/src/purchase_listinator/adapters/in/shopping_initiation.clj
+++ /dev/null
@@ -1,10 +0,0 @@
-(ns purchase-listinator.adapters.in.shopping-initiation
-  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
-           [purchase-listinator.models.internal.shopping-initiation :as models.internal.shopping-initiation]
-           [purchase-listinator.adapters.misc :as adapters.misc]
-           [schema.core :as s]))
-
-(s/defn wire->internal :- models.internal.shopping-initiation/ShoppingInitiation
-  [{:keys [id list-id] :as wire} :- wires.in.shopping/ShoppingInitiation]
-  (assoc wire :id (adapters.misc/string->uuid id)
-              :list-id (adapters.misc/string->uuid list-id)))
diff --git a/src/purchase_listinator/adapters/in/shopping_initiation_data_request.clj b/src/purchase_listinator/adapters/in/shopping_initiation_data_request.clj
deleted file mode 100644
index 6dcc9d7..0000000
--- a/src/purchase_listinator/adapters/in/shopping_initiation_data_request.clj
+++ /dev/null
@@ -1,11 +0,0 @@
-(ns purchase-listinator.adapters.in.shopping-initiation-data-request
-  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
-            [purchase-listinator.models.internal.shopping-initiation-data-request :as models.internal.shopping-initiation]
-            [purchase-listinator.adapters.misc :as adapters.misc]
-            [schema.core :as s]))
-
-(s/defn wire->internal :- models.internal.shopping-initiation/ShoppingInitiationDataRequest
-  [{:keys [list-id latitude longitude] :as wire} :- wires.in.shopping/ShoppingInitiationDataRequest]
-  (assoc wire :list-id (adapters.misc/string->uuid list-id)
-              :latitude (Double/parseDouble latitude)
-              :longitude (Double/parseDouble longitude)))
diff --git a/src/purchase_listinator/adapters/out/shopping.clj b/src/purchase_listinator/adapters/out/shopping.clj
deleted file mode 100644
index e03dc67..0000000
--- a/src/purchase_listinator/adapters/out/shopping.clj
+++ /dev/null
@@ -1,14 +0,0 @@
-(ns purchase-listinator.adapters.out.shopping
-  (:require
-    [schema.core :as s]
-    [purchase-listinator.wires.out.shopping :as wires.out.shopping]
-    [purchase-listinator.models.internal.shopping :as models.internal.shopping]))
-
-(s/defn ->ShoppingFinishedEvent :- wires.out.shopping/ShoppingFinishedEvent
-  [{:keys [user-id] :as shopping} :- models.internal.shopping/Shopping
-   moment :- s/Num
-   event-id :- s/Uuid]
-  {:event-id event-id
-   :user-id user-id
-   :moment   moment
-   :shopping shopping})
diff --git a/src/purchase_listinator/adapters/out/shopping_initiation_data.clj b/src/purchase_listinator/adapters/out/shopping_initiation_data.clj
deleted file mode 100644
index b1bcacc..0000000
--- a/src/purchase_listinator/adapters/out/shopping_initiation_data.clj
+++ /dev/null
@@ -1,9 +0,0 @@
-(ns purchase-listinator.adapters.out.shopping-initiation-data
-  (:require [purchase-listinator.models.internal.shopping :as models.internal.shopping]
-            [purchase-listinator.wires.out.shopping-initiation-data :as wires.out.shopping-initiation-data]
-            [schema.core :as s]))
-
-(s/defn shopping->wire :- wires.out.shopping-initiation-data/ShoppingInitiationData
-  [{:keys [place type]} :- models.internal.shopping/Shopping]
-  {:place place
-   :type  type})
diff --git a/src/purchase_listinator/components/datahike.clj b/src/purchase_listinator/components/datahike.clj
new file mode 100644
index 0000000..21cb0da
--- /dev/null
+++ b/src/purchase_listinator/components/datahike.clj
@@ -0,0 +1,25 @@
+(ns purchase-listinator.components.datahike
+  (:require [com.stuartsierra.component :as component]
+            [datahike.api :as d]))
+
+(defn create-schema [conn, schemas]
+  (d/transact conn schemas))
+
+(defrecord Datahike [config-key schemas config]
+  component/Lifecycle
+
+  (start [component]
+    (try (d/create-database (-> config config-key))
+         (catch Exception e
+           (println e)))
+    (let [conn (d/connect (-> config config-key))]
+      (create-schema conn schemas)
+      (assoc component :connection conn)))
+
+  (stop [component]
+    (d/release (:connection component))
+    (dissoc component :connection)))
+
+(defn new-datahike [config-key schemas]
+  (map->Datahike {:config-key config-key
+                  :schemas schemas}))
diff --git a/src/purchase_listinator/components/datomic.clj b/src/purchase_listinator/components/datomic.clj
index 93749fc..234bb23 100644
--- a/src/purchase_listinator/components/datomic.clj
+++ b/src/purchase_listinator/components/datomic.clj
@@ -14,9 +14,6 @@
                     datomic.purchase-list/schema
                     datomic.purchase-category/schema
                     datomic.purchase-item/schema
-                    datomic.shopping/schema
-                    dbs.datomic.shopping-item/schema
-                    dbs.datomic.shopping-category/schema
                     dbs.datomic.share/schema))
 
 (defn create-schema [conn]
diff --git a/src/purchase_listinator/components/mongo.clj b/src/purchase_listinator/components/mongo.clj
index 4358bd9..b278dda 100644
--- a/src/purchase_listinator/components/mongo.clj
+++ b/src/purchase_listinator/components/mongo.clj
@@ -1,9 +1,6 @@
 (ns purchase-listinator.components.mongo
   (:require [monger.core :as mg]
-            [com.stuartsierra.component :as component]
-            [purchase-listinator.dbs.mongo.shopping-location :as dbs.mongo.shopping-location]))
-
-(def indexes (vector dbs.mongo.shopping-location/indexes))
+            [com.stuartsierra.component :as component]))
 
 (defn connect-by-uri
   [uri]
@@ -16,7 +13,7 @@
     {:conn conn
      :db   db}))
 
-(defrecord Mongo [config]
+(defrecord Mongo [config indexes]
   component/Lifecycle
   (start [this]
     (let [{{:keys [host port db-name uri]} :mongo} config
@@ -35,8 +32,8 @@
     (dissoc this :connection :db)))
 
 (defn new-mongo
-  []
-  (map->Mongo {}))
+  [indexes]
+  (map->Mongo {:indexes indexes}))
 
 
 (defrecord MongoFake [config]
diff --git a/src/purchase_listinator/core.clj b/src/purchase_listinator/core.clj
index df5d064..b5ed6bf 100644
--- a/src/purchase_listinator/core.clj
+++ b/src/purchase_listinator/core.clj
@@ -9,13 +9,15 @@
     [purchase-listinator.modules.events.core :as modules.events.core]
     [purchase-listinator.modules.price-suggestion.core :as modules.price-suggestion.core]
     [purchase-listinator.modules.shopping-cart.core :as modules.shopping-cart.core]
+    [purchase-listinator.modules.shopping.core :as modules.shopping.core]
     [purchase-listinator.purchase-listinator-core :as purchase-listinator-core])
   (:gen-class))
 
 (def modules-config [purchase-listinator-core/module-config
                      modules.events.core/config
                      modules.price-suggestion.core/config
-                     modules.shopping-cart.core/config])
+                     modules.shopping-cart.core/config
+                     modules.shopping.core/config])
 (def system-config
   (reduce conj
           {:env        (keyword (or (System/getenv "ENVIRONMENT_TYPE") "dev"))
diff --git a/src/purchase_listinator/logic/shopping_category.clj b/src/purchase_listinator/logic/shopping_category.clj
deleted file mode 100644
index b60069d..0000000
--- a/src/purchase_listinator/logic/shopping_category.clj
+++ /dev/null
@@ -1,10 +0,0 @@
-(ns purchase-listinator.logic.shopping-category
-  (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping-list :as models.internal.shopping-list]
-            [purchase-listinator.models.internal.shopping-category :as models.internal.shopping-category]))
-
-(s/defn ->shopping-category :- models.internal.shopping-category/ShoppingCategory
-  [shopping-id :- s/Uuid
-   list-category :- models.internal.shopping-list/ShoppingListCategory]
-  (-> (assoc list-category :shopping-id shopping-id)
-      (dissoc :purchase-list-id)))
diff --git a/src/purchase_listinator/models/internal/cart.clj b/src/purchase_listinator/models/internal/cart.clj
deleted file mode 100644
index cd05121..0000000
--- a/src/purchase_listinator/models/internal/cart.clj
+++ /dev/null
@@ -1,9 +0,0 @@
-(ns purchase-listinator.models.internal.cart
-  (:require
-    [purchase-listinator.models.internal.cart-events :as internal.cart-events]
-    [purchase-listinator.models.internal.shopping.purchase-list :as internal.shopping.purchase-list]
-    [schema.core :as s]))
-
-(s/defschema Cart
-  {:purchase-list        internal.shopping.purchase-list/PurchaseList
-   :shopping-cart-events [internal.cart-events/CartEvent]})
diff --git a/src/purchase_listinator/adapters/db/shopping.clj b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
similarity index 66%
rename from src/purchase_listinator/adapters/db/shopping.clj
rename to src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
index 784da6a..a33d604 100644
--- a/src/purchase_listinator/adapters/db/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
@@ -1,17 +1,17 @@
-(ns purchase-listinator.adapters.db.shopping
+(ns purchase-listinator.modules.shopping.adapters.db.datomic.shopping
   (:require [schema.core :as s]
             [purchase-listinator.misc.general :as misc.general]
             [purchase-listinator.misc.datomic :as misc.datomic]
-            [purchase-listinator.models.internal.shopping :as models.internal.shopping]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]))
 
 (s/defn internal->db
-  [{:keys [list-id] :as internal} :- models.internal.shopping/Shopping]
+  [{:keys [list-id] :as internal} :- models.shopping/Shopping]
   (-> internal
       (assoc :list {:purchase-list/id list-id})
       (dissoc :list-id :categories)
       (misc.general/namespace-keys :shopping)))
 
-(s/defn db->internal :- models.internal.shopping/Shopping
+(s/defn db->internal :- models.shopping/Shopping
   [{:shopping/keys [list] :as db-wire}]
    (when (not-empty db-wire)
     (-> (misc.datomic/datomic->entity db-wire)
diff --git a/src/purchase_listinator/adapters/db/shopping_category.clj b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_category.clj
similarity index 81%
rename from src/purchase_listinator/adapters/db/shopping_category.clj
rename to src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_category.clj
index d8131df..e2155ee 100644
--- a/src/purchase_listinator/adapters/db/shopping_category.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_category.clj
@@ -1,8 +1,8 @@
-(ns purchase-listinator.adapters.db.shopping-category
+(ns purchase-listinator.modules.shopping.adapters.db.datomic.shopping-category
   (:require [schema.core :as s]
             [purchase-listinator.misc.general :as misc.general]
             [purchase-listinator.misc.datomic :as misc.datomic]
-            [purchase-listinator.models.internal.shopping-category :as models.internal.shopping-category]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping-category :as models.internal.shopping-category]))
 
 
 (s/defn internal->db
diff --git a/src/purchase_listinator/adapters/db/shopping_item.clj b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_item.clj
similarity index 82%
rename from src/purchase_listinator/adapters/db/shopping_item.clj
rename to src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_item.clj
index 6e8da21..0691686 100644
--- a/src/purchase_listinator/adapters/db/shopping_item.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping_item.clj
@@ -1,8 +1,8 @@
-(ns purchase-listinator.adapters.db.shopping-item
+(ns purchase-listinator.modules.shopping.adapters.db.datomic.shopping-item
   (:require [schema.core :as s]
             [purchase-listinator.misc.general :as misc.general]
             [purchase-listinator.misc.datomic :as misc.datomic]
-            [purchase-listinator.models.internal.shopping-item :as models.internal.shopping-item]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping-item :as models.internal.shopping-item]))
 
 (s/defn internal->db
   [{:keys [category-id order-position price] :as internal} :- models.internal.shopping-item/ShoppingItem]
diff --git a/src/purchase_listinator/adapters/db/mongo/shopping_location.clj b/src/purchase_listinator/modules/shopping/adapters/db/mongo/shopping_location.clj
similarity index 71%
rename from src/purchase_listinator/adapters/db/mongo/shopping_location.clj
rename to src/purchase_listinator/modules/shopping/adapters/db/mongo/shopping_location.clj
index a1e9082..12bb83a 100644
--- a/src/purchase_listinator/adapters/db/mongo/shopping_location.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/db/mongo/shopping_location.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.adapters.db.mongo.shopping-location
+(ns purchase-listinator.modules.shopping.adapters.db.mongo.shopping-location
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping-location :as models.internal.shopping-location]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping-location :as models.internal.shopping-location]))
 
 (s/defn internal->db
   [{:keys [latitude longitude] :as internal} :- models.internal.shopping-location/ShoppingLocation]
diff --git a/src/purchase_listinator/adapters/in/cart.clj b/src/purchase_listinator/modules/shopping/adapters/in/cart.clj
similarity index 56%
rename from src/purchase_listinator/adapters/in/cart.clj
rename to src/purchase_listinator/modules/shopping/adapters/in/cart.clj
index 0f11a38..2b1ae41 100644
--- a/src/purchase_listinator/adapters/in/cart.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/cart.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.adapters.in.cart
+(ns purchase-listinator.modules.shopping.adapters.in.cart
   (:require
-    [purchase-listinator.models.internal.cart :as models.internal.cart]
+    [purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart]
     [purchase-listinator.wires.in.cart :as wires.in.cart]
     [schema.core :as s]))
 
diff --git a/src/purchase_listinator/adapters/in/price_suggestion.clj b/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
similarity index 59%
rename from src/purchase_listinator/adapters/in/price_suggestion.clj
rename to src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
index b736846..a3d9252 100644
--- a/src/purchase_listinator/adapters/in/price_suggestion.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
@@ -1,7 +1,7 @@
-(ns purchase-listinator.adapters.in.price-suggestion
+(ns purchase-listinator.modules.shopping.adapters.in.price-suggestion
   (:require [schema.core :as s]
             [purchase-listinator.wires.in.price-suggestion :as wires.in.price-suggestion]
-            [purchase-listinator.models.internal.price-suggestion :as models.internal.price-suggestion]))
+            [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]))
 
 (s/defn wire->internal :- models.internal.price-suggestion/ShoppingItemSuggestedPrices
   [wire :- wires.in.price-suggestion/ShoppingItemSuggestedPrices]
diff --git a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
new file mode 100644
index 0000000..1730f18
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
@@ -0,0 +1,10 @@
+(ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation
+  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
+           [purchase-listinator.modules.shopping.schemas.models.shopping-initiation :as shopping.models.shopping-initiation]
+           [purchase-listinator.modules.shopping.adapters.misc :as adapters.misc]
+           [schema.core :as s]))
+
+(s/defn wire->internal :- shopping.models.shopping-initiation/ShoppingInitiation
+  [{:keys [id list-id] :as wire} :- wires.in.shopping/ShoppingInitiation]
+  (assoc wire :id (adapters.misc/string->uuid id)
+              :list-id (adapters.misc/string->uuid list-id)))
diff --git a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
new file mode 100644
index 0000000..38d7292
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
@@ -0,0 +1,11 @@
+(ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation-data-request
+  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-initiation-data-request :as models.shopping-initiation-data-request]
+            [purchase-listinator.modules.shopping.adapters.misc :as adapters.misc]
+            [schema.core :as s]))
+
+(s/defn wire->internal :- models.shopping-initiation-data-request/ShoppingInitiationDataRequest
+  [{:keys [list-id latitude longitude] :as wire} :- wires.in.shopping/ShoppingInitiationDataRequest]
+  (assoc wire :list-id (adapters.misc/string->uuid list-id)
+              :latitude (Double/parseDouble latitude)
+              :longitude (Double/parseDouble longitude)))
diff --git a/src/purchase_listinator/modules/shopping/adapters/out/shopping.clj b/src/purchase_listinator/modules/shopping/adapters/out/shopping.clj
new file mode 100644
index 0000000..2994510
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/adapters/out/shopping.clj
@@ -0,0 +1,14 @@
+(ns purchase-listinator.modules.shopping.adapters.out.shopping
+  (:require
+    [schema.core :as s]
+    [purchase-listinator.modules.shopping.schemas.models.shopping :as shopping.models.shopping]
+    [purchase-listinator.modules.shopping.schemas.wires.out.shopping :as wires.out.shopping]))
+
+(s/defn ->ShoppingFinishedEvent :- wires.out.shopping/ShoppingFinishedEvent
+  [{:keys [user-id] :as shopping} :- shopping.models.shopping/Shopping
+   moment :- s/Num
+   event-id :- s/Uuid]
+  {:event-id event-id
+   :user-id user-id
+   :moment   moment
+   :shopping shopping})
diff --git a/src/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data.clj b/src/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data.clj
new file mode 100644
index 0000000..42f3643
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data.clj
@@ -0,0 +1,9 @@
+(ns purchase-listinator.modules.shopping.adapters.out.shopping-initiation-data
+  (:require [purchase-listinator.modules.shopping.schemas.models.shopping :as models.internal.shopping]
+            [purchase-listinator.modules.shopping.schemas.wires.out.shopping-initiation-data :as wires.out.shopping-initiation-data]
+            [schema.core :as s]))
+
+(s/defn shopping->wire :- wires.out.shopping-initiation-data/ShoppingInitiationData
+  [{:keys [place type]} :- models.internal.shopping/Shopping]
+  {:place place
+   :type  type})
diff --git a/src/purchase_listinator/modules/shopping/core.clj b/src/purchase_listinator/modules/shopping/core.clj
new file mode 100644
index 0000000..ef9aaa3
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/core.clj
@@ -0,0 +1,87 @@
+(ns purchase-listinator.modules.shopping.core
+  (:require [com.stuartsierra.component :as component]
+            [purchase-listinator.components.http :as components.http]
+            [purchase-listinator.components.mongo :as components.mongo]
+            [purchase-listinator.components.rabbitmq-channel :as components.rabbitmq-channel]
+            [purchase-listinator.modules.shopping.diplomat.db.datomic.shopping :as datomic.shopping]
+            [purchase-listinator.modules.shopping.diplomat.db.datomic.shopping-item :as datomic.shopping-item]
+            [purchase-listinator.modules.shopping.diplomat.db.datomic.shopping-category :as datomic.shopping-category]
+            [purchase-listinator.modules.shopping.diplomat.http.server :as http.server]
+            [purchase-listinator.modules.shopping.diplomat.db.mongo.shopping-location :as db.mongo.shopping-location]
+            [purchase-listinator.components.datahike :as components.datahike]
+            [purchase-listinator.components.mongo :as components.mongo]
+            [purchase-listinator.components.rabbitmq :as components.rabbitmq]))
+
+(def rabbitmq-dependencies
+  [:config :shopping/main-db])
+(def webapp-dependencies
+  [:shopping/rabbitmq :shopping/main-db :shopping/http :shopping/mongo])
+
+(def schemas
+  [datomic.shopping/schema
+   datomic.shopping-item/schema
+   datomic.shopping-category/schema])
+
+(def mongo-indexes
+  [db.mongo.shopping-location/indexes])
+
+(def components
+  {:shopping/http             (component/using (components.http/new-http :shopping/request-routes) [:config])
+   :shopping/main-db          (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
+   :shopping/rabbitmq-channel (component/using (components.rabbitmq-channel/new-rabbit-mq-channel :shopping/rabbitmq) [:config])
+   :shopping/rabbitmq         (component/using (components.rabbitmq/new-rabbit-mq-v2 :shopping/rabbitmq :shopping/rabbitmq-channel []) rabbitmq-dependencies)
+   :shopping/mongo            (component/using (components.mongo/new-mongo mongo-indexes) [:config])})
+
+(def system-components-test
+  {:shopping/main-db  (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
+   :shopping/rabbitmq (component/using (components.rabbitmq/new-rabbit-mq-fake) rabbitmq-dependencies)
+   ;todo: fake mongo
+   :mongo    (component/using (components.mongo/new-mongo-fake) [:config])})
+
+(def request-routes
+  {:price-suggestion/items       (or (System/getenv "PRICE_SUGGESTION_ITEMS_URL") "http://localhost:3000/api/price-suggestion/by/items")
+   :purchase-list/allowed-lists  (or (System/getenv "PURCHASE_LIST_URL") "http://localhost:3000/api/lists/allowed")
+   :shopping-cart/receive-events (or (System/getenv "SHOPPING_CART_RECEIVE_EVENTS") "http://localhost:3000/api/shopping-cart/events")
+   :shopping-cart/init-cart      (or (System/getenv "SHOPPING_CART_INITIATE_CART") "http://localhost:3000/api/shopping-cart/initiate")
+   :shopping-cart/cart           (or (System/getenv "SHOPPING_CART_GET_CART") "http://localhost:3000/api/shopping-cart/by/:list-id/:shopping-id")
+   :shopping-cart/exclusive-cart (or (System/getenv "SHOPPING_CART_GET_EXCLUSIVE_CART") "http://localhost:3000/api/shopping-cart/exclusive-by/:list-id/:shopping-id")})
+
+
+(def system-config
+  {:mongo                   {:port    27017
+                             :host    (or (System/getenv "MONGODB_HOST") "localhost")
+                             :db-name "purchase-listinator"
+                             :uri     (or (System/getenv "MONGODB_URI") nil)}
+   :shopping/main-db        {:store (if (System/getenv "DATAHIKE_PATH")
+                                      {:backend :file
+                                       :path    (or (System/getenv "DATAHIKE_PATH") "")}
+                                      {:backend :mem
+                                       :id      "shopping/database"})}
+   :shopping/rabbitmq       {:host     (or (System/getenv "RABBITMQ_HOST") "localhost")
+                             :port     5672
+                             :username "guest"
+                             :password "guest"
+                             :vhost    "/"}
+   :shopping/request-routes request-routes})
+
+(defn config-test
+  []
+  {:shopping/main-db  {:store {:backend :mem
+                               :id      (str (random-uuid))}}
+   :shopping/rabbitmq {}
+   :mongo      {:port    27017
+                :host    (or (System/getenv "MONGODB_HOST") "localhost")
+                :db-name "purchase-listinator-test"
+                :uri     (or (System/getenv "MONGODB_URI") nil)}})
+(def config
+  {:rabbitmq-dependencies rabbitmq-dependencies
+   :webapp-dependencies   webapp-dependencies
+   :system-components     components
+   :system-config         system-config
+   :routes                (set (concat http.server/routes))})
+
+
+(defn system-config-test
+  []
+  {:system-components system-components-test
+   :system-config     (config-test)})
\ No newline at end of file
diff --git a/src/purchase_listinator/dbs/datomic/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
similarity index 70%
rename from src/purchase_listinator/dbs/datomic/shopping.clj
rename to src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
index 8be8f41..361c23a 100644
--- a/src/purchase_listinator/dbs/datomic/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
@@ -1,11 +1,11 @@
-(ns purchase-listinator.dbs.datomic.shopping
+(ns purchase-listinator.modules.shopping.diplomat.db.datomic.shopping
   (:require [schema.core :as s]
             [datahike.api :as d]
-            [purchase-listinator.adapters.db.shopping :as adapter.shopping]
-            [purchase-listinator.misc.datomic :as misc.datomic]
-            [purchase-listinator.models.internal.shopping :as models.internal.shopping]
-            [purchase-listinator.adapters.db.shopping-item :as adapters.db.shopping-item]
-            [purchase-listinator.adapters.db.shopping-category :as adapters.db.shopping-category]))
+            [purchase-listinator.modules.shopping.adapters.db.datomic.shopping :as adapter.shopping]
+            [purchase-listinator.modules.shopping.misc.datomic :as misc.datomic]
+            [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]
+            [purchase-listinator.modules.shopping.adapters.datomic.db.shopping-item :as adapters.db.shopping-item]
+            [purchase-listinator.modules.shopping.adapters.datomic.db.shopping-category :as adapters.db.shopping-category]))
 
 (def schema
   [{:db/ident       :shopping/id
@@ -36,17 +36,17 @@
     :db/doc         "user id"}])
 
 (s/defn upsert
-  [{:keys [categories] :as shopping} :- models.internal.shopping/Shopping
+  [{:keys [categories] :as shopping} :- models.shopping/Shopping
    {:keys [connection]}]
-  (let [items (map adapters.db.shopping-item/internal->db (mapcat :items categories))
-        categories (map adapters.db.shopping-category/internal->db categories)
+  (let [items (map adapter.shopping/internal->db (mapcat :items categories))
+        categories (map adapter.shopping/internal->db categories)
         shopping (adapter.shopping/internal->db shopping)]
     (->> (concat [shopping] categories items)
          (apply misc.datomic/transact connection)))
   shopping)
 
 
-(s/defn get-in-progress-by-list-id :- [models.internal.shopping/Shopping]
+(s/defn get-in-progress-by-list-id :- [models.shopping/Shopping]
   [list-id :- s/Uuid
    allowed-lists-ids :- [s/Uuid]
    {:keys [connection]}]
@@ -60,7 +60,7 @@
             (d/db connection) list-id allowed-lists-ids)
        (map adapter.shopping/db->internal)))
 
-(s/defn get-by-id :- models.internal.shopping/Shopping
+(s/defn get-by-id :- models.shopping/Shopping
   [id :- s/Uuid
    allowed-lists-ids :- [s/Uuid]
    {:keys [connection]}]
diff --git a/src/purchase_listinator/dbs/datomic/shopping_category.clj b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_category.clj
similarity index 82%
rename from src/purchase_listinator/dbs/datomic/shopping_category.clj
rename to src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_category.clj
index d176c5e..abd958c 100644
--- a/src/purchase_listinator/dbs/datomic/shopping_category.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_category.clj
@@ -1,8 +1,8 @@
-(ns purchase-listinator.dbs.datomic.shopping-category
+(ns purchase-listinator.modules.shopping.diplomat.db.datomic.shopping-category
   (:require [schema.core :as s]
             [datahike.api :as d]
-            [purchase-listinator.adapters.db.shopping-category :as adapters.db.shopping-category]
-            [purchase-listinator.models.internal.shopping-category :as models.internal.shopping-category]))
+            [purchase-listinator.modules.shopping.adapters.db.datomic.shopping-category :as adapters.db.shopping-category]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-category :as models.internal.shopping-category]))
 
 (def schema
   [{:db/ident       :shopping-category/id
diff --git a/src/purchase_listinator/dbs/datomic/shopping_item.clj b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_item.clj
similarity index 85%
rename from src/purchase_listinator/dbs/datomic/shopping_item.clj
rename to src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_item.clj
index bb0b7f6..60acf5f 100644
--- a/src/purchase_listinator/dbs/datomic/shopping_item.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping_item.clj
@@ -1,8 +1,8 @@
-(ns purchase-listinator.dbs.datomic.shopping-item
+(ns purchase-listinator.modules.shopping.diplomat.db.datomic.shopping-item
   (:require [schema.core :as s]
             [datahike.api :as d]
-            [purchase-listinator.adapters.db.shopping-item :as adapters.db.shopping-item]
-            [purchase-listinator.models.internal.shopping-item :as models.internal.shopping-item]
+            [purchase-listinator.modules.shopping.adapters.db.datomic.shopping-item :as adapters.db.shopping-item]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-item :as models.internal.shopping-item]
             [purchase-listinator.misc.datomic :as misc.datomic]))
 
 (def schema
diff --git a/src/purchase_listinator/dbs/mongo/shopping_location.clj b/src/purchase_listinator/modules/shopping/diplomat/db/mongo/shopping_location.clj
similarity index 76%
rename from src/purchase_listinator/dbs/mongo/shopping_location.clj
rename to src/purchase_listinator/modules/shopping/diplomat/db/mongo/shopping_location.clj
index c7d31e2..b4091a4 100644
--- a/src/purchase_listinator/dbs/mongo/shopping_location.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/mongo/shopping_location.clj
@@ -1,7 +1,7 @@
-(ns purchase-listinator.dbs.mongo.shopping-location
+(ns purchase-listinator.modules.shopping.diplomat.db.mongo.shopping-location
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping-location :as models.internal.shopping-location]
-            [purchase-listinator.adapters.db.mongo.shopping-location :as adapters.db.mongo.shopping-location]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-location :as models.internal.shopping-location]
+            [purchase-listinator.modules.shopping.adapters.db.mongo.shopping-location :as adapters.db.mongo.shopping-location]
             [monger.collection :as mc]))
 
 (def collection :shopping-location-test)
diff --git a/src/purchase_listinator/endpoints/http/client/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
similarity index 86%
rename from src/purchase_listinator/endpoints/http/client/shopping.clj
rename to src/purchase_listinator/modules/shopping/diplomat/http/client.clj
index fa0fa82..990db76 100644
--- a/src/purchase_listinator/endpoints/http/client/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
@@ -1,12 +1,12 @@
-(ns purchase-listinator.endpoints.http.client.shopping
+(ns purchase-listinator.modules.shopping.diplomat.http.client
   (:require
     [purchase-listinator.components.http :as components.http]
-    [purchase-listinator.models.internal.cart :as models.internal.cart]
-    [purchase-listinator.models.internal.price-suggestion :as models.internal.price-suggestion]
+    [purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart]
+    [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]
     [purchase-listinator.wires.in.price-suggestion :as wires.in.price-suggestion]
-    [purchase-listinator.adapters.in.price-suggestion :as adapters.in.price-suggestion]
+    [purchase-listinator.modules.shopping.adapters.in.price-suggestion :as adapters.in.price-suggestion]
     [purchase-listinator.wires.in.cart :as wires.in.cart]
-    [purchase-listinator.adapters.in.cart :as adapters.in.cart]
+    [purchase-listinator.modules.shopping.adapters.in.cart :as adapters.in.cart]
     [schema.core :as s]))
 
 (s/defn get-price-suggestion :- models.internal.price-suggestion/ShoppingItemSuggestedPrices
diff --git a/src/purchase_listinator/endpoints/http/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/http/server.clj
similarity index 83%
rename from src/purchase_listinator/endpoints/http/shopping.clj
rename to src/purchase_listinator/modules/shopping/diplomat/http/server.clj
index d7700cc..2a2c204 100644
--- a/src/purchase_listinator/endpoints/http/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/http/server.clj
@@ -1,12 +1,12 @@
-(ns purchase-listinator.endpoints.http.shopping
+(ns purchase-listinator.modules.shopping.diplomat.http.server
   (:require [schema.core :as s]
             [cats.monad.either :refer :all]
             [purchase-listinator.misc.http :as misc.http]
             [purchase-listinator.misc.either :as misc.either]
-            [purchase-listinator.flows.shopping :as flows.shopping]
-            [purchase-listinator.adapters.out.shopping-initiation-data :as adapters.out.shopping-initiation-data]
-            [purchase-listinator.adapters.in.shopping-initiation :as adapters.in.shopping-initiation]
-            [purchase-listinator.adapters.in.shopping-initiation-data-request :as adapters.in.shopping-initiation-data-request]
+            [purchase-listinator.modules.shopping.flows.shopping :as flows.shopping]
+            [purchase-listinator.modules.shopping.adapters.out.shopping-initiation-data :as adapters.out.shopping-initiation-data]
+            [purchase-listinator.modules.shopping.adapters.in.shopping-initiation :as adapters.in.shopping-initiation]
+            [purchase-listinator.modules.shopping.adapters.in.shopping-initiation-data-request :as adapters.in.shopping-initiation-data-request]
             [purchase-listinator.adapters.misc :as adapters.misc]))
 
 (s/defn init-shopping
diff --git a/src/purchase_listinator/publishers/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
similarity index 63%
rename from src/purchase_listinator/publishers/shopping.clj
rename to src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
index 0c6bbc8..c5a3baa 100644
--- a/src/purchase_listinator/publishers/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
@@ -1,10 +1,10 @@
-(ns purchase-listinator.publishers.shopping
+(ns purchase-listinator.modules.shopping.diplomat.publishers.shopping
   (:require
     [schema.core :as s]
-    [purchase-listinator.adapters.out.shopping :as adapters.out.shopping]
     [purchase-listinator.misc.date :as misc.date]
     [purchase-listinator.misc.general :as misc.general]
-    [purchase-listinator.models.internal.shopping :as models.internal.shopping]))
+    [purchase-listinator.modules.shopping.adapters.out.shopping :as adapters.out.shopping]
+    [purchase-listinator.modules.shopping.schemas.models.shopping :as models.internal.shopping]))
 
 (s/defn shopping-finished :- models.internal.shopping/Shopping
   [shopping :- models.internal.shopping/Shopping
diff --git a/src/purchase_listinator/flows/shopping.clj b/src/purchase_listinator/modules/shopping/flows/shopping.clj
similarity index 69%
rename from src/purchase_listinator/flows/shopping.clj
rename to src/purchase_listinator/modules/shopping/flows/shopping.clj
index 569b4a4..11b9a3b 100644
--- a/src/purchase_listinator/flows/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/flows/shopping.clj
@@ -1,31 +1,30 @@
-(ns purchase-listinator.flows.shopping
+(ns purchase-listinator.modules.shopping.flows.shopping
   (:require
     [schema.core :as s]
     [cats.monad.either :refer [left]]
     [clojure.core.async :refer [go <!! <!] :as async]
     [purchase-listinator.misc.either :as either]
-    [purchase-listinator.models.internal.shopping-initiation :as models.internal.shopping-initiation]
-    [purchase-listinator.dbs.datomic.shopping :as datomic.shopping]
-    [purchase-listinator.components.http :as components.http]
-    [purchase-listinator.logic.shopping :as logic.shopping]
-    [purchase-listinator.logic.shopping-location :as logic.shopping-location]
+    [purchase-listinator.modules.shopping.schemas.models.shopping-initiation :as models.internal.shopping-initiation]
+    [purchase-listinator.modules.shopping.diplomat.db.datomic.shopping :as datomic.shopping]
+    [purchase-listinator.modules.shopping.logic.shopping :as logic.shopping]
+    [purchase-listinator.modules.shopping.logic.shopping-location :as logic.shopping-location]
     [purchase-listinator.misc.date :as misc.date]
-    [purchase-listinator.dbs.mongo.shopping-location :as mongo.shopping-location]
-    [purchase-listinator.misc.general :as misc.general]
-    [purchase-listinator.logic.errors :as logic.errors]
-    [purchase-listinator.models.internal.shopping-initiation-data-request :as models.internal.shopping-initiation-data-request]
-    [purchase-listinator.logic.shopping-cart-event :as logic.shopping-cart-event]
-    [purchase-listinator.logic.shopping-cart :as logic.shopping-cart]
-    [purchase-listinator.logic.shopping-category :as logic.shopping-category]
-    [purchase-listinator.publishers.shopping :as publishers.shopping]
-    [purchase-listinator.endpoints.http.client.shopping :as http.client.shopping]))
+    [purchase-listinator.modules.shopping.diplomat.db.mongo.shopping-location :as mongo.shopping-location]
+    [purchase-listinator.modules.shopping.misc.general :as misc.general]
+    [purchase-listinator.modules.shopping.schemas.models.shopping-initiation-data-request :as models.internal.shopping-initiation-data-request]
+    [purchase-listinator.modules.shopping.logic.shopping-cart-event :as logic.shopping-cart-event]
+    [purchase-listinator.components.http :as components.http]
+    [purchase-listinator.modules.shopping.logic.shopping-cart :as logic.shopping-cart]
+    [purchase-listinator.modules.shopping.logic.shopping-category :as logic.shopping-category]
+    [purchase-listinator.modules.shopping.diplomat.publishers.shopping :as publishers.shopping]
+    [purchase-listinator.modules.shopping.diplomat.http.client :as http.client.shopping]))
 
 (s/defn init-shopping
   [{shopping-id      :id
     purchase-list-id :list-id
     :as              shopping-initiation} :- models.internal.shopping-initiation/ShoppingInitiation
    user-id :- s/Uuid
-   {:keys [datomic mongo http]}]
+   {:shopping/keys [main-db mongo http]}]
   (either/try-right
     (let [now (misc.date/numb-now)
           shopping (-> (logic.shopping/initiation->shopping shopping-initiation now)
@@ -33,7 +32,7 @@
       (->> [(go (http.client.shopping/init-shopping-cart shopping-id purchase-list-id user-id http))
             (go (-> (logic.shopping-location/initiation->shopping-location shopping-initiation (misc.general/squuid))
                     (mongo.shopping-location/upsert mongo)))
-            (go (datomic.shopping/upsert shopping datomic))]
+            (go (datomic.shopping/upsert shopping main-db))]
            (async/map vector)
            <!!
            last))))
@@ -41,11 +40,11 @@
 (s/defn get-initial-data
   [{:keys [latitude longitude]} :- models.internal.shopping-initiation-data-request/ShoppingInitiationDataRequest
    user-id :- s/Uuid
-   {:keys [mongo datomic http]}]
+   {:shopping/keys [mongo main-db http]}]
   (let [allowed-lists-ids (http.client.shopping/get-allowed-lists user-id http)
         near-places (mongo.shopping-location/find-by-location latitude longitude mongo)
         first-near-shopping (and (seq near-places)
-                                 (datomic.shopping/get-by-id (-> near-places first :shopping-id) allowed-lists-ids datomic))]
+                                 (datomic.shopping/get-by-id (-> near-places first :shopping-id) allowed-lists-ids main-db))]
     (if first-near-shopping
       first-near-shopping
       (left {:status 404 :data "not-found"}))))
@@ -63,18 +62,18 @@
 (s/defn get-in-progress-list
   [shopping-id :- s/Uuid
    user-id :- s/Uuid
-   {:keys [datomic http]}]
+   {:shopping/keys [main-db http]}]
   (let [allowed-lists-ids (http.client.shopping/get-allowed-lists user-id http)
-        {:keys [list-id]} (datomic.shopping/get-by-id shopping-id allowed-lists-ids datomic)
+        {:keys [list-id]} (datomic.shopping/get-by-id shopping-id allowed-lists-ids main-db)
         shopping-module-completed (cart-module-management list-id user-id shopping-id http)]
     shopping-module-completed))
 
 (s/defn active-shopping
   [list-id :- s/Uuid
    user-id :- s/Uuid
-   {:keys [datomic http]}]
+   {:shopping/keys [main-db http]}]
   (let [allowed-lists-ids (http.client.shopping/get-allowed-lists user-id http)]
-    (datomic.shopping/get-in-progress-by-list-id list-id allowed-lists-ids datomic)))
+    (datomic.shopping/get-in-progress-by-list-id list-id allowed-lists-ids main-db)))
 
 (s/defn finished-shopping
   [user-id :- s/Uuid
@@ -94,10 +93,10 @@
 (s/defn finish
   [shopping-id :- s/Uuid
    user-id :- s/Uuid
-   {:keys [datomic rabbitmq http]}]
+   {:shopping/keys [main-db rabbitmq http]}]
   (let [allowed-lists-ids (http.client.shopping/get-allowed-lists user-id http)
-        shopping (datomic.shopping/get-by-id shopping-id allowed-lists-ids datomic)
+        shopping (datomic.shopping/get-by-id shopping-id allowed-lists-ids main-db)
         shopping (finished-shopping user-id shopping http)]
-    (datomic.shopping/upsert shopping datomic)
+    (datomic.shopping/upsert shopping main-db)
     (publishers.shopping/shopping-finished shopping rabbitmq)))
 
diff --git a/src/purchase_listinator/logic/shopping.clj b/src/purchase_listinator/modules/shopping/logic/shopping.clj
similarity index 77%
rename from src/purchase_listinator/logic/shopping.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping.clj
index 1a2681b..f945c3e 100644
--- a/src/purchase_listinator/logic/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping.clj
@@ -1,11 +1,10 @@
-(ns purchase-listinator.logic.shopping
+(ns purchase-listinator.modules.shopping.logic.shopping
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping :as models.internal.shopping]
-            [purchase-listinator.models.internal.purchase-list.purchase-list-management-data :as purchase-list-management-data]
-            [purchase-listinator.models.internal.shopping-list :as models.internal.shopping-list]
-            [purchase-listinator.models.internal.shopping-initiation :as models.internal.shopping-initiation]
-            [purchase-listinator.models.internal.shopping-category :as models.internal.shopping-category]
-            [purchase-listinator.models.internal.shopping-item :as models.internal.shopping-item]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping :as models.internal.shopping]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-initiation :as models.internal.shopping-initiation]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-category :as models.internal.shopping-category]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-item :as models.internal.shopping-item]))
 
 (s/defn initiation->shopping :- models.internal.shopping/Shopping
   [shopping :- models.internal.shopping-initiation/ShoppingInitiation
@@ -16,7 +15,7 @@
 
 (s/defn purchase-list->shopping-list :- models.internal.shopping-list/ShoppingList
   [shopping-id :- s/Uuid
-   purchase-list :- purchase-list-management-data/ManagementData]
+   purchase-list :- models.internal.shopping-list/ManagementData]
   (assoc purchase-list :shopping-id shopping-id))
 
 (s/defn link-with-user :- models.internal.shopping/Shopping
diff --git a/src/purchase_listinator/logic/shopping_cart.clj b/src/purchase_listinator/modules/shopping/logic/shopping_cart.clj
similarity index 50%
rename from src/purchase_listinator/logic/shopping_cart.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping_cart.clj
index a464b63..3c74357 100644
--- a/src/purchase_listinator/logic/shopping_cart.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_cart.clj
@@ -1,7 +1,7 @@
-(ns purchase-listinator.logic.shopping-cart
+(ns purchase-listinator.modules.shopping.logic.shopping-cart
   (:require
-    [purchase-listinator.models.internal.cart :as models.internal.cart]
-    [purchase-listinator.models.internal.cart-events :as internal.cart-events]
+    [purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart]
+    [purchase-listinator.modules.shopping.schemas.models.cart-events :as internal.cart-events]
     [schema.core :as s]))
 
 (s/defn ->shopping-cart :- internal.cart-events/Cart
diff --git a/src/purchase_listinator/logic/shopping_cart_event.clj b/src/purchase_listinator/modules/shopping/logic/shopping_cart_event.clj
similarity index 93%
rename from src/purchase_listinator/logic/shopping_cart_event.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping_cart_event.clj
index 572462a..42573cc 100644
--- a/src/purchase_listinator/logic/shopping_cart_event.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_cart_event.clj
@@ -1,10 +1,10 @@
-(ns purchase-listinator.logic.shopping-cart-event
-  (:require [purchase-listinator.models.internal.shopping-list :as models.internal.shopping-list]
-            [purchase-listinator.models.internal.cart-events :as internal.cart-events]
-            [purchase-listinator.logic.shopping-item :as logic.shopping-item]
-            [purchase-listinator.logic.shopping-purchase-list-cart-event :as logic.shopping-purchase-list-cart-event]
-            [purchase-listinator.logic.reposition :as logic.reposition]
-            [purchase-listinator.logic.shopping :as logic.shopping]
+(ns purchase-listinator.modules.shopping.logic.shopping-cart-event
+  (:require [purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list]
+            [purchase-listinator.modules.shopping.schemas.models.cart-events :as internal.cart-events]
+            [purchase-listinator.modules.shopping.logic.shopping-item :as logic.shopping-item]
+            [purchase-listinator.modules.shopping.logic.shopping-purchase-list-cart-event :as logic.shopping-purchase-list-cart-event]
+            [purchase-listinator.logic.reposition :as logic.reposition] ;todo: technical debt: outside the module
+            [purchase-listinator.modules.shopping.logic.shopping :as logic.shopping]
             [schema.core :as s]))
 
 (defmulti apply-event (fn [{:keys [event-type]} _] event-type))
diff --git a/src/purchase_listinator/modules/shopping/logic/shopping_category.clj b/src/purchase_listinator/modules/shopping/logic/shopping_category.clj
new file mode 100644
index 0000000..f02a0a2
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_category.clj
@@ -0,0 +1,10 @@
+(ns purchase-listinator.modules.shopping.logic.shopping-category
+  (:require [schema.core :as s]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-category :as models.internal.shopping-category]))
+
+(s/defn ->shopping-category :- models.internal.shopping-category/ShoppingCategory
+  [shopping-id :- s/Uuid
+   list-category :- models.internal.shopping-list/ShoppingListCategory]
+  (-> (assoc list-category :shopping-id shopping-id)
+      (dissoc :purchase-list-id)))
diff --git a/src/purchase_listinator/logic/shopping_item.clj b/src/purchase_listinator/modules/shopping/logic/shopping_item.clj
similarity index 75%
rename from src/purchase_listinator/logic/shopping_item.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping_item.clj
index eaa3bb4..36bed84 100644
--- a/src/purchase_listinator/logic/shopping_item.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_item.clj
@@ -1,5 +1,5 @@
-(ns purchase-listinator.logic.shopping-item
-  (:require [purchase-listinator.models.internal.shopping-list :as models.internal.shopping-list]
+(ns purchase-listinator.modules.shopping.logic.shopping-item
+  (:require [purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list]
             [schema.core :as s]))
 
 (s/defn update-item-price :- models.internal.shopping-list/ShoppingItem
diff --git a/src/purchase_listinator/logic/shopping_location.clj b/src/purchase_listinator/modules/shopping/logic/shopping_location.clj
similarity index 58%
rename from src/purchase_listinator/logic/shopping_location.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping_location.clj
index 815cc4f..883ab3e 100644
--- a/src/purchase_listinator/logic/shopping_location.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_location.clj
@@ -1,7 +1,7 @@
-(ns purchase-listinator.logic.shopping-location
+(ns purchase-listinator.modules.shopping.logic.shopping-location
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping-location :as models.internal.shopping-location]
-            [purchase-listinator.models.internal.shopping-initiation :as models.internal.shopping-initiation]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping-location :as models.internal.shopping-location]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-initiation :as models.internal.shopping-initiation]))
 
 (s/defn initiation->shopping-location :- models.internal.shopping-location/ShoppingLocation
   [{:keys [id] :as shopping-initiation} :- models.internal.shopping-initiation/ShoppingInitiation
diff --git a/src/purchase_listinator/logic/shopping_purchase_list_cart_event.clj b/src/purchase_listinator/modules/shopping/logic/shopping_purchase_list_cart_event.clj
similarity index 66%
rename from src/purchase_listinator/logic/shopping_purchase_list_cart_event.clj
rename to src/purchase_listinator/modules/shopping/logic/shopping_purchase_list_cart_event.clj
index c08fe19..e35f6aa 100644
--- a/src/purchase_listinator/logic/shopping_purchase_list_cart_event.clj
+++ b/src/purchase_listinator/modules/shopping/logic/shopping_purchase_list_cart_event.clj
@@ -1,7 +1,7 @@
-(ns purchase-listinator.logic.shopping-purchase-list-cart-event
+(ns purchase-listinator.modules.shopping.logic.shopping-purchase-list-cart-event
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.cart-events :as internal.cart-events]
-            [purchase-listinator.models.internal.shopping-list :as models.internal.shopping-list]))
+            [purchase-listinator.modules.shopping.schemas.models.cart-events :as internal.cart-events]
+            [purchase-listinator.modules.shopping.schemas.models.shopping-list :as models.internal.shopping-list]))
 
 (s/defn created->category :- models.internal.shopping-list/ShoppingListCategory
   [{:keys [category-id] :as event} :- internal.cart-events/PurchaseListCategoryCreated]
diff --git a/src/purchase_listinator/modules/shopping/schemas/models/cart.clj b/src/purchase_listinator/modules/shopping/schemas/models/cart.clj
new file mode 100644
index 0000000..dbad0b8
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/schemas/models/cart.clj
@@ -0,0 +1,9 @@
+(ns purchase-listinator.modules.shopping.schemas.models.cart
+  (:require
+    [purchase-listinator.modules.shopping.schemas.models.cart-events :as internal.cart-events]
+    [purchase-listinator.modules.shopping.schemas.models.purchase-list :as internal.shopping.purchase-list]
+    [schema.core :as s]))
+
+(s/defschema Cart
+  {:purchase-list        internal.shopping.purchase-list/PurchaseList
+   :shopping-cart-events [internal.cart-events/CartEvent]})
diff --git a/src/purchase_listinator/models/internal/cart_events.clj b/src/purchase_listinator/modules/shopping/schemas/models/cart_events.clj
similarity index 98%
rename from src/purchase_listinator/models/internal/cart_events.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/cart_events.clj
index eb1fc17..5860b24 100644
--- a/src/purchase_listinator/models/internal/cart_events.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/cart_events.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.cart-events
+(ns purchase-listinator.modules.shopping.schemas.models.cart-events
   (:require [schema.core :as s]))
 
 (def purchase-list-categoty-created-skeleton
diff --git a/src/purchase_listinator/models/internal/price_suggestion.clj b/src/purchase_listinator/modules/shopping/schemas/models/price_suggestion.clj
similarity index 77%
rename from src/purchase_listinator/models/internal/price_suggestion.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/price_suggestion.clj
index d023e86..319db0c 100644
--- a/src/purchase_listinator/models/internal/price_suggestion.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/price_suggestion.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.price-suggestion
+(ns purchase-listinator.modules.shopping.schemas.models.price-suggestion
   (:require [schema.core :as s]))
 
 (s/defschema ShoppingItemSuggestedPrice
diff --git a/src/purchase_listinator/models/internal/shopping/purchase_list.clj b/src/purchase_listinator/modules/shopping/schemas/models/purchase_list.clj
similarity index 90%
rename from src/purchase_listinator/models/internal/shopping/purchase_list.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/purchase_list.clj
index e8bc8cd..f340661 100644
--- a/src/purchase_listinator/models/internal/shopping/purchase_list.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/purchase_list.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping.purchase-list
+(ns purchase-listinator.modules.shopping.schemas.models.purchase-list
   (:require [schema.core :as s]))
 
 (def item-skeleton
diff --git a/src/purchase_listinator/models/internal/shopping.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping.clj
similarity index 75%
rename from src/purchase_listinator/models/internal/shopping.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping.clj
index 2bb68a8..1546ee2 100644
--- a/src/purchase_listinator/models/internal/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.models.internal.shopping
+(ns purchase-listinator.modules.shopping.schemas.models.shopping
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.shopping-category :as models.internal.shopping-category]))
+            [purchase-listinator.modules.shopping.schemas.models.shopping-category :as models.internal.shopping-category]))
 
 (def status (s/enum :in-progress :done :canceled))
 (s/defschema Status status)
diff --git a/src/purchase_listinator/models/internal/shopping_category.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_category.clj
similarity index 62%
rename from src/purchase_listinator/models/internal/shopping_category.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_category.clj
index d1336c2..b33811b 100644
--- a/src/purchase_listinator/models/internal/shopping_category.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_category.clj
@@ -1,5 +1,5 @@
-(ns purchase-listinator.models.internal.shopping-category
-  (:require [purchase-listinator.models.internal.shopping-item :as models.internal.shopping-item]
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-category
+  (:require [purchase-listinator.modules.shopping.schemas.models.shopping-item :as models.internal.shopping-item]
             [schema.core :as s]))
 
 (def shopping-category-skeleton
diff --git a/src/purchase_listinator/models/internal/shopping_initiation.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation.clj
similarity index 77%
rename from src/purchase_listinator/models/internal/shopping_initiation.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation.clj
index d3036f6..3032339 100644
--- a/src/purchase_listinator/models/internal/shopping_initiation.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping-initiation
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-initiation
   (:require [schema.core :as s]))
 
 (def shopping-initiation-skeleton
diff --git a/src/purchase_listinator/models/internal/shopping_initiation_data_request.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation_data_request.clj
similarity index 72%
rename from src/purchase_listinator/models/internal/shopping_initiation_data_request.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation_data_request.clj
index 198e617..c5e27ca 100644
--- a/src/purchase_listinator/models/internal/shopping_initiation_data_request.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_initiation_data_request.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping-initiation-data-request
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-initiation-data-request
   (:require [schema.core :as s]))
 
 (def shopping-initiation-data-request-skeleton
diff --git a/src/purchase_listinator/models/internal/shopping_item.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_item.clj
similarity index 82%
rename from src/purchase_listinator/models/internal/shopping_item.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_item.clj
index c6699c7..0fe4d09 100644
--- a/src/purchase_listinator/models/internal/shopping_item.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_item.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping-item
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-item
   (:require [schema.core :as s]))
 
 (def shopping-item-skeleton
diff --git a/src/purchase_listinator/models/internal/shopping_list.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_list.clj
similarity index 85%
rename from src/purchase_listinator/models/internal/shopping_list.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_list.clj
index 19eb00d..78ec655 100644
--- a/src/purchase_listinator/models/internal/shopping_list.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_list.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping-list
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-list
   (:require [schema.core :as s]))
 
 (def shopping-item-skeleton
@@ -29,3 +29,5 @@
    :categories       [ShoppingListCategory]})
 (s/defschema ShoppingList shopping-list-skeleton)
 
+(s/defschema ManagementData (dissoc shopping-list-skeleton :shopping-id))
+
diff --git a/src/purchase_listinator/models/internal/shopping_location.clj b/src/purchase_listinator/modules/shopping/schemas/models/shopping_location.clj
similarity index 73%
rename from src/purchase_listinator/models/internal/shopping_location.clj
rename to src/purchase_listinator/modules/shopping/schemas/models/shopping_location.clj
index 320c60c..06a50ce 100644
--- a/src/purchase_listinator/models/internal/shopping_location.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/models/shopping_location.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.models.internal.shopping-location
+(ns purchase-listinator.modules.shopping.schemas.models.shopping-location
   (:require [schema.core :as s]))
 
 (def shopping-location
diff --git a/src/purchase_listinator/wires/in/cart.clj b/src/purchase_listinator/modules/shopping/schemas/wires/in/cart.clj
similarity index 82%
rename from src/purchase_listinator/wires/in/cart.clj
rename to src/purchase_listinator/modules/shopping/schemas/wires/in/cart.clj
index 025f416..a3812d9 100644
--- a/src/purchase_listinator/wires/in/cart.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/wires/in/cart.clj
@@ -1,9 +1,9 @@
-(ns purchase-listinator.wires.in.cart
+(ns purchase-listinator.modules.shopping.schemas.wires.in.cart
   (:require
     [purchase-listinator.misc.schema :as misc.schema]
-    [purchase-listinator.models.internal.shopping.purchase-list :as internal.shopping.purchase-list]
+    [purchase-listinator.modules.shopping.schemas.models.purchase-list :as internal.shopping.purchase-list]
     [schema.core :as s]
-    [purchase-listinator.models.internal.cart-events :as internal.cart-events]))
+    [purchase-listinator.modules.shopping.schemas.models.cart-events :as internal.cart-events]))
 
 (s/defn of-type
   [expected-event-type {:keys [event-type]}]
diff --git a/src/purchase_listinator/wires/in/price_suggestion.clj b/src/purchase_listinator/modules/shopping/schemas/wires/in/price_suggestion.clj
similarity index 53%
rename from src/purchase_listinator/wires/in/price_suggestion.clj
rename to src/purchase_listinator/modules/shopping/schemas/wires/in/price_suggestion.clj
index ccee54e..38602b6 100644
--- a/src/purchase_listinator/wires/in/price_suggestion.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/wires/in/price_suggestion.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.wires.in.price-suggestion
+(ns purchase-listinator.modules.shopping.schemas.wires.in.price-suggestion
   (:require [schema.core :as s]
-            [purchase-listinator.models.internal.price-suggestion :as models.internal.price-suggestion]))
+            [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]))
 
 (s/def ShoppingItemSuggestedPrice
   models.internal.price-suggestion/ShoppingItemSuggestedPrice)
diff --git a/src/purchase_listinator/wires/in/shopping.clj b/src/purchase_listinator/modules/shopping/schemas/wires/in/shopping.clj
similarity index 87%
rename from src/purchase_listinator/wires/in/shopping.clj
rename to src/purchase_listinator/modules/shopping/schemas/wires/in/shopping.clj
index 4cf23ea..0fddb15 100644
--- a/src/purchase_listinator/wires/in/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/wires/in/shopping.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.wires.in.shopping
+(ns purchase-listinator.modules.shopping.schemas.wires.in.shopping
   (:require [schema.core :as s]))
 
 (def shopping-initiation-skeleton
diff --git a/src/purchase_listinator/modules/shopping/schemas/wires/out/shopping.clj b/src/purchase_listinator/modules/shopping/schemas/wires/out/shopping.clj
new file mode 100644
index 0000000..832dc06
--- /dev/null
+++ b/src/purchase_listinator/modules/shopping/schemas/wires/out/shopping.clj
@@ -0,0 +1,10 @@
+(ns purchase-listinator.modules.shopping.schemas.wires.out.shopping
+  (:require
+    [schema.core :as s]
+    [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]))
+
+(s/defschema ShoppingFinishedEvent
+  {:event-id s/Uuid
+   :user-id  s/Uuid
+   :moment   s/Num
+   :shopping models.shopping/Shopping})
diff --git a/src/purchase_listinator/wires/out/shopping_initiation_data.clj b/src/purchase_listinator/modules/shopping/schemas/wires/out/shopping_initiation_data.clj
similarity index 68%
rename from src/purchase_listinator/wires/out/shopping_initiation_data.clj
rename to src/purchase_listinator/modules/shopping/schemas/wires/out/shopping_initiation_data.clj
index c92c0b1..e087216 100644
--- a/src/purchase_listinator/wires/out/shopping_initiation_data.clj
+++ b/src/purchase_listinator/modules/shopping/schemas/wires/out/shopping_initiation_data.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.wires.out.shopping-initiation-data
+(ns purchase-listinator.modules.shopping.schemas.wires.out.shopping-initiation-data
   (:require [schema.core :as s]))
 
 (def shopping-initiation-data-skeleton
diff --git a/src/purchase_listinator/modules/shopping_cart/core.clj b/src/purchase_listinator/modules/shopping_cart/core.clj
index 301e620..1a63381 100644
--- a/src/purchase_listinator/modules/shopping_cart/core.clj
+++ b/src/purchase_listinator/modules/shopping_cart/core.clj
@@ -33,7 +33,7 @@
 (def system-config
   {:shopping-cart/request-routes request-routes
    :shopping-cart/redis          {:host     (or (System/getenv "SHOPPING_CART_REDIS_HOST") "localhost")
-                                  :port     (or (System/getenv "SHOPPING_CART_REDIS_PORT") 6380)
+                                  :port     (or (some-> (System/getenv "SHOPPING_CART_REDIS_PORT") int) 6379)
                                   :username (or (System/getenv "SHOPPING_CART_REDIS_USERNAME") nil)
                                   :password (or (System/getenv "SHOPPING_CART_REDIS_PASSWORD") "pass")
                                   :timeout  6000}
diff --git a/src/purchase_listinator/purchase_listinator_core.clj b/src/purchase_listinator/purchase_listinator_core.clj
index 95c0634..4c27041 100644
--- a/src/purchase_listinator/purchase_listinator_core.clj
+++ b/src/purchase_listinator/purchase_listinator_core.clj
@@ -1,10 +1,8 @@
 (ns purchase-listinator.purchase-listinator-core
   (:require [com.stuartsierra.component :as component]
             [purchase-listinator.components.datomic :as datomic]
-            [purchase-listinator.components.mongo :as mongo]
             [purchase-listinator.components.rabbitmq :as rabbitmq]
             [purchase-listinator.endpoints.http.purchase-list :as http.purchase-list]
-            [purchase-listinator.endpoints.http.shopping :as http.shopping]
             [purchase-listinator.endpoints.http.user :as endpoints.http.user]
             [purchase-listinator.components.http :as components.http]))
 
@@ -12,25 +10,15 @@
   [:config :datomic :mongo :http])
 
 (def purchase-listinator-components
-  {:mongo    (component/using (mongo/new-mongo) [:config])
-   :datomic  (component/using (datomic/new-datomic) [:config :service-map])
+  {:datomic  (component/using (datomic/new-datomic) [:config :service-map])
    :rabbitmq (component/using (rabbitmq/new-rabbit-mq) rabbitmq-dependencies)
    :http     (component/using (components.http/new-http :shopping/request-routes) [:config])})
 
 (def request-routes
-  {:price-suggestion/items       (or (System/getenv "PRICE_SUGGESTION_ITEMS_URL") "http://localhost:3000/api/price-suggestion/by/items")
-   :purchase-list/allowed-lists  (or (System/getenv "PURCHASE_LIST_URL") "http://localhost:3000/api/lists/allowed")
-   :shopping-cart/receive-events (or (System/getenv "SHOPPING_CART_RECEIVE_EVENTS") "http://localhost:3000/api/shopping-cart/events")
-   :shopping-cart/init-cart      (or (System/getenv "SHOPPING_CART_INITIATE_CART") "http://localhost:3000/api/shopping-cart/initiate")
-   :shopping-cart/cart           (or (System/getenv "SHOPPING_CART_GET_CART") "http://localhost:3000/api/shopping-cart/by/:list-id/:shopping-id")
-   :shopping-cart/exclusive-cart (or (System/getenv "SHOPPING_CART_GET_EXCLUSIVE_CART") "http://localhost:3000/api/shopping-cart/exclusive-by/:list-id/:shopping-id")})
+  {:purchase-list/allowed-lists  (or (System/getenv "PURCHASE_LIST_URL") "http://localhost:3000/api/lists/allowed")})
 
 (def purchase-listinator-config
-  {:mongo                   {:port    27017
-                             :host    (or (System/getenv "MONGODB_HOST") "localhost")
-                             :db-name "purchase-listinator"
-                             :uri     (or (System/getenv "MONGODB_URI") nil)}
-   :datomic                 {:store (if (System/getenv "DATAHIKE_PATH")
+  {:datomic                 {:store (if (System/getenv "DATAHIKE_PATH")
                                       {:backend :file
                                        :path    (or (System/getenv "DATAHIKE_PATH") "")}
                                       {:backend :mem
@@ -45,9 +33,7 @@
 (def system-components-test
   {:datomic  (component/using (datomic/new-datomic) [:config :service-map])
    :rabbitmq (component/using (rabbitmq/new-rabbit-mq-fake) [])
-   :http     (component/using (components.http/new-http-mock) [:config])
-   ;todo: fake mongo
-   :mongo    (component/using (mongo/new-mongo-fake) [:config])})
+   :http     (component/using (components.http/new-http-mock) [:config])})
 
 (defn system-config-test
   []
@@ -55,19 +41,14 @@
    :web-server {:port 5150
                 :host "192.168.1.104"}
    :datomic    {:store {:backend :mem
-                        :id      (str (random-uuid))}}
-   :mongo      {:port    27017
-                :host    (or (System/getenv "MONGODB_HOST") "localhost")
-                :db-name "purchase-listinator-test"
-                :uri     (or (System/getenv "MONGODB_URI") nil)}})
+                        :id      (str (random-uuid))}}})
 
 
 (def module-config
   {:rabbitmq-dependencies rabbitmq-dependencies
    :webapp-dependencies   [:service-map :mongo :datomic :rabbitmq :http]
    :routes                (set (concat endpoints.http.user/routes
-                                       http.purchase-list/routes
-                                       http.shopping/routes))
+                                       http.purchase-list/routes))
    :system-config         purchase-listinator-config
    :system-components     purchase-listinator-components})
 
diff --git a/src/purchase_listinator/wires/out/shopping.clj b/src/purchase_listinator/wires/out/shopping.clj
deleted file mode 100644
index 977b5cf..0000000
--- a/src/purchase_listinator/wires/out/shopping.clj
+++ /dev/null
@@ -1,10 +0,0 @@
-(ns purchase-listinator.wires.out.shopping
-  (:require
-    [schema.core :as s]
-    [purchase-listinator.models.internal.shopping :as models.internal.shopping]))
-
-(s/defschema ShoppingFinishedEvent
-  {:event-id s/Uuid
-   :user-id  s/Uuid
-   :moment   s/Num
-   :shopping models.internal.shopping/Shopping})

From a386f817af591c9511ccb9a6929f624c8e3d5efa Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Mon, 5 Aug 2024 23:13:00 -0300
Subject: [PATCH 2/8] fix: changes to compile the project with the shopping
 module

---
 src/purchase_listinator/components/datahike.clj    |  2 +-
 src/purchase_listinator/components/mongo.clj       |  9 +++++----
 src/purchase_listinator/logic/reposition.clj       |  7 -------
 .../modules/shopping/adapters/in/cart.clj          |  2 +-
 .../shopping/adapters/in/shopping_initiation.clj   |  4 ++--
 .../in/shopping_initiation_data_request.clj        |  4 ++--
 src/purchase_listinator/modules/shopping/core.clj  | 14 +++++++-------
 .../shopping/diplomat/db/datomic/shopping.clj      |  6 ++----
 .../modules/shopping/diplomat/http/client.clj      |  2 +-
 .../modules/shopping/flows/shopping.clj            |  2 +-
 .../purchase_listinator_core.clj                   |  4 ++--
 11 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/src/purchase_listinator/components/datahike.clj b/src/purchase_listinator/components/datahike.clj
index 21cb0da..d41af2e 100644
--- a/src/purchase_listinator/components/datahike.clj
+++ b/src/purchase_listinator/components/datahike.clj
@@ -2,7 +2,7 @@
   (:require [com.stuartsierra.component :as component]
             [datahike.api :as d]))
 
-(defn create-schema [conn, schemas]
+(defn create-schema [conn schemas]
   (d/transact conn schemas))
 
 (defrecord Datahike [config-key schemas config]
diff --git a/src/purchase_listinator/components/mongo.clj b/src/purchase_listinator/components/mongo.clj
index b278dda..64f82ae 100644
--- a/src/purchase_listinator/components/mongo.clj
+++ b/src/purchase_listinator/components/mongo.clj
@@ -13,10 +13,10 @@
     {:conn conn
      :db   db}))
 
-(defrecord Mongo [config indexes]
+(defrecord Mongo [config config-key indexes]
   component/Lifecycle
   (start [this]
-    (let [{{:keys [host port db-name uri]} :mongo} config
+    (let [{{:keys [host port db-name uri]} config-key} config
           conn (mg/connect {:host host :port port})
           db (mg/get-db conn db-name)]
       (if uri
@@ -32,8 +32,9 @@
     (dissoc this :connection :db)))
 
 (defn new-mongo
-  [indexes]
-  (map->Mongo {:indexes indexes}))
+  [config-key indexes]
+  (map->Mongo {:indexes indexes
+               :config-key config-key}))
 
 
 (defrecord MongoFake [config]
diff --git a/src/purchase_listinator/logic/reposition.clj b/src/purchase_listinator/logic/reposition.clj
index 5d446de..87107f1 100644
--- a/src/purchase_listinator/logic/reposition.clj
+++ b/src/purchase_listinator/logic/reposition.clj
@@ -23,13 +23,6 @@
     (decrement-order item)
     item))
 
-(s/defn increment-if-after-or-equal :- models.logic.reposition/Reorder
-  [position
-   {:keys [order-position] :as item} :- models.logic.reposition/Reorder]
-  (if (>= order-position position)
-    (increment-order item)
-    item))
-
 (s/defn ^:private reposition-one :- models.logic.reposition/Reorder
   [old-position :- s/Num
    new-position :- s/Num
diff --git a/src/purchase_listinator/modules/shopping/adapters/in/cart.clj b/src/purchase_listinator/modules/shopping/adapters/in/cart.clj
index 2b1ae41..c7c3da7 100644
--- a/src/purchase_listinator/modules/shopping/adapters/in/cart.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/cart.clj
@@ -1,7 +1,7 @@
 (ns purchase-listinator.modules.shopping.adapters.in.cart
   (:require
     [purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart]
-    [purchase-listinator.wires.in.cart :as wires.in.cart]
+    [purchase-listinator.modules.shopping.schemas.wires.in.cart :as wires.in.cart]
     [schema.core :as s]))
 
 (s/defn wire->internal :- models.internal.cart/Cart
diff --git a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
index 1730f18..11fe646 100644
--- a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation.clj
@@ -1,7 +1,7 @@
 (ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation
-  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
+  (:require [purchase-listinator.modules.shopping.schemas.wires.in.shopping :as wires.in.shopping]
            [purchase-listinator.modules.shopping.schemas.models.shopping-initiation :as shopping.models.shopping-initiation]
-           [purchase-listinator.modules.shopping.adapters.misc :as adapters.misc]
+           [purchase-listinator.adapters.misc :as adapters.misc]
            [schema.core :as s]))
 
 (s/defn wire->internal :- shopping.models.shopping-initiation/ShoppingInitiation
diff --git a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
index 38d7292..a4057e6 100644
--- a/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request.clj
@@ -1,7 +1,7 @@
 (ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation-data-request
-  (:require [purchase-listinator.wires.in.shopping :as wires.in.shopping]
+  (:require [purchase-listinator.modules.shopping.schemas.wires.in.shopping :as wires.in.shopping]
             [purchase-listinator.modules.shopping.schemas.models.shopping-initiation-data-request :as models.shopping-initiation-data-request]
-            [purchase-listinator.modules.shopping.adapters.misc :as adapters.misc]
+            [purchase-listinator.adapters.misc :as adapters.misc]
             [schema.core :as s]))
 
 (s/defn wire->internal :- models.shopping-initiation-data-request/ShoppingInitiationDataRequest
diff --git a/src/purchase_listinator/modules/shopping/core.clj b/src/purchase_listinator/modules/shopping/core.clj
index ef9aaa3..dbcaf42 100644
--- a/src/purchase_listinator/modules/shopping/core.clj
+++ b/src/purchase_listinator/modules/shopping/core.clj
@@ -18,9 +18,9 @@
   [:shopping/rabbitmq :shopping/main-db :shopping/http :shopping/mongo])
 
 (def schemas
-  [datomic.shopping/schema
-   datomic.shopping-item/schema
-   datomic.shopping-category/schema])
+  (concat datomic.shopping/schema
+          datomic.shopping-item/schema
+          datomic.shopping-category/schema))
 
 (def mongo-indexes
   [db.mongo.shopping-location/indexes])
@@ -30,13 +30,13 @@
    :shopping/main-db          (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
    :shopping/rabbitmq-channel (component/using (components.rabbitmq-channel/new-rabbit-mq-channel :shopping/rabbitmq) [:config])
    :shopping/rabbitmq         (component/using (components.rabbitmq/new-rabbit-mq-v2 :shopping/rabbitmq :shopping/rabbitmq-channel []) rabbitmq-dependencies)
-   :shopping/mongo            (component/using (components.mongo/new-mongo mongo-indexes) [:config])})
+   :shopping/mongo            (component/using (components.mongo/new-mongo :shopping/mongo mongo-indexes) [:config])})
 
 (def system-components-test
   {:shopping/main-db  (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
    :shopping/rabbitmq (component/using (components.rabbitmq/new-rabbit-mq-fake) rabbitmq-dependencies)
    ;todo: fake mongo
-   :mongo    (component/using (components.mongo/new-mongo-fake) [:config])})
+   :shopping/mongo    (component/using (components.mongo/new-mongo-fake) [:config])})
 
 (def request-routes
   {:price-suggestion/items       (or (System/getenv "PRICE_SUGGESTION_ITEMS_URL") "http://localhost:3000/api/price-suggestion/by/items")
@@ -48,7 +48,7 @@
 
 
 (def system-config
-  {:mongo                   {:port    27017
+  {:shopping/mongo                   {:port    27017
                              :host    (or (System/getenv "MONGODB_HOST") "localhost")
                              :db-name "purchase-listinator"
                              :uri     (or (System/getenv "MONGODB_URI") nil)}
@@ -69,7 +69,7 @@
   {:shopping/main-db  {:store {:backend :mem
                                :id      (str (random-uuid))}}
    :shopping/rabbitmq {}
-   :mongo      {:port    27017
+   :shopping/mongo      {:port    27017
                 :host    (or (System/getenv "MONGODB_HOST") "localhost")
                 :db-name "purchase-listinator-test"
                 :uri     (or (System/getenv "MONGODB_URI") nil)}})
diff --git a/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
index 361c23a..763a31e 100644
--- a/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
@@ -2,10 +2,8 @@
   (:require [schema.core :as s]
             [datahike.api :as d]
             [purchase-listinator.modules.shopping.adapters.db.datomic.shopping :as adapter.shopping]
-            [purchase-listinator.modules.shopping.misc.datomic :as misc.datomic]
-            [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]
-            [purchase-listinator.modules.shopping.adapters.datomic.db.shopping-item :as adapters.db.shopping-item]
-            [purchase-listinator.modules.shopping.adapters.datomic.db.shopping-category :as adapters.db.shopping-category]))
+            [purchase-listinator.misc.datomic :as misc.datomic]
+            [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]))
 
 (def schema
   [{:db/ident       :shopping/id
diff --git a/src/purchase_listinator/modules/shopping/diplomat/http/client.clj b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
index 990db76..61dba08 100644
--- a/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
@@ -5,7 +5,7 @@
     [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]
     [purchase-listinator.wires.in.price-suggestion :as wires.in.price-suggestion]
     [purchase-listinator.modules.shopping.adapters.in.price-suggestion :as adapters.in.price-suggestion]
-    [purchase-listinator.wires.in.cart :as wires.in.cart]
+    [purchase-listinator.modules.shopping.schemas.wires.in.cart :as wires.in.cart]
     [purchase-listinator.modules.shopping.adapters.in.cart :as adapters.in.cart]
     [schema.core :as s]))
 
diff --git a/src/purchase_listinator/modules/shopping/flows/shopping.clj b/src/purchase_listinator/modules/shopping/flows/shopping.clj
index 11b9a3b..78b775e 100644
--- a/src/purchase_listinator/modules/shopping/flows/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/flows/shopping.clj
@@ -10,7 +10,7 @@
     [purchase-listinator.modules.shopping.logic.shopping-location :as logic.shopping-location]
     [purchase-listinator.misc.date :as misc.date]
     [purchase-listinator.modules.shopping.diplomat.db.mongo.shopping-location :as mongo.shopping-location]
-    [purchase-listinator.modules.shopping.misc.general :as misc.general]
+    [purchase-listinator.misc.general :as misc.general]
     [purchase-listinator.modules.shopping.schemas.models.shopping-initiation-data-request :as models.internal.shopping-initiation-data-request]
     [purchase-listinator.modules.shopping.logic.shopping-cart-event :as logic.shopping-cart-event]
     [purchase-listinator.components.http :as components.http]
diff --git a/src/purchase_listinator/purchase_listinator_core.clj b/src/purchase_listinator/purchase_listinator_core.clj
index 4c27041..d3aac61 100644
--- a/src/purchase_listinator/purchase_listinator_core.clj
+++ b/src/purchase_listinator/purchase_listinator_core.clj
@@ -7,7 +7,7 @@
             [purchase-listinator.components.http :as components.http]))
 
 (def rabbitmq-dependencies
-  [:config :datomic :mongo :http])
+  [:config :datomic :http])
 
 (def purchase-listinator-components
   {:datomic  (component/using (datomic/new-datomic) [:config :service-map])
@@ -46,7 +46,7 @@
 
 (def module-config
   {:rabbitmq-dependencies rabbitmq-dependencies
-   :webapp-dependencies   [:service-map :mongo :datomic :rabbitmq :http]
+   :webapp-dependencies   [:service-map :datomic :rabbitmq :http]
    :routes                (set (concat endpoints.http.user/routes
                                        http.purchase-list/routes))
    :system-config         purchase-listinator-config

From 831f6496f5a7b1d8b302fa8f6ee0aeb1cfd9404a Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Tue, 6 Aug 2024 22:26:32 -0300
Subject: [PATCH 3/8] fix: architecture

---
 .../shopping/adapters/db/datomic/shopping.clj | 12 ++++-------
 .../modules/shopping/core.clj                 |  2 +-
 .../shopping/diplomat/db/datomic/shopping.clj | 20 +++++++++----------
 .../shopping/diplomat/publishers/shopping.clj |  8 +++++---
 .../modules/shopping/flows/shopping.clj       |  4 ++--
 5 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
index a33d604..3642650 100644
--- a/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/db/datomic/shopping.clj
@@ -5,16 +5,12 @@
             [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]))
 
 (s/defn internal->db
-  [{:keys [list-id] :as internal} :- models.shopping/Shopping]
-  (-> internal
-      (assoc :list {:purchase-list/id list-id})
-      (dissoc :list-id :categories)
+  [internal :- models.shopping/Shopping]
+  (-> (dissoc internal :categories)
       (misc.general/namespace-keys :shopping)))
 
 (s/defn db->internal :- models.shopping/Shopping
-  [{:shopping/keys [list] :as db-wire}]
+  [db-wire]
    (when (not-empty db-wire)
     (-> (misc.datomic/datomic->entity db-wire)
-        (misc.general/unnamespace-keys)
-        (assoc :list-id (:purchase-list/id list))
-        (dissoc :list))))
+        (misc.general/unnamespace-keys))))
diff --git a/src/purchase_listinator/modules/shopping/core.clj b/src/purchase_listinator/modules/shopping/core.clj
index dbcaf42..381cab6 100644
--- a/src/purchase_listinator/modules/shopping/core.clj
+++ b/src/purchase_listinator/modules/shopping/core.clj
@@ -15,7 +15,7 @@
 (def rabbitmq-dependencies
   [:config :shopping/main-db])
 (def webapp-dependencies
-  [:shopping/rabbitmq :shopping/main-db :shopping/http :shopping/mongo])
+  [:shopping/rabbitmq :shopping/rabbitmq-channel :shopping/main-db :shopping/http :shopping/mongo])
 
 (def schemas
   (concat datomic.shopping/schema
diff --git a/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
index 763a31e..9d4cfed 100644
--- a/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/db/datomic/shopping.clj
@@ -2,6 +2,8 @@
   (:require [schema.core :as s]
             [datahike.api :as d]
             [purchase-listinator.modules.shopping.adapters.db.datomic.shopping :as adapter.shopping]
+            [purchase-listinator.modules.shopping.adapters.db.datomic.shopping-item :as adapter.shopping-item]
+            [purchase-listinator.modules.shopping.adapters.db.datomic.shopping-category :as adapter.shopping-category]
             [purchase-listinator.misc.datomic :as misc.datomic]
             [purchase-listinator.modules.shopping.schemas.models.shopping :as models.shopping]))
 
@@ -22,8 +24,8 @@
    {:db/ident       :shopping/date
     :db/valueType   :db.type/long
     :db/cardinality :db.cardinality/one}
-   {:db/ident       :shopping/list
-    :db/valueType   :db.type/ref
+   {:db/ident       :shopping/list-id
+    :db/valueType   :db.type/uuid
     :db/cardinality :db.cardinality/one}
    {:db/ident       :shopping/status
     :db/valueType   :db.type/keyword
@@ -36,8 +38,8 @@
 (s/defn upsert
   [{:keys [categories] :as shopping} :- models.shopping/Shopping
    {:keys [connection]}]
-  (let [items (map adapter.shopping/internal->db (mapcat :items categories))
-        categories (map adapter.shopping/internal->db categories)
+  (let [items (map adapter.shopping-item/internal->db (mapcat :items categories))
+        categories (map adapter.shopping-category/internal->db categories)
         shopping (adapter.shopping/internal->db shopping)]
     (->> (concat [shopping] categories items)
          (apply misc.datomic/transact connection)))
@@ -48,12 +50,11 @@
   [list-id :- s/Uuid
    allowed-lists-ids :- [s/Uuid]
    {:keys [connection]}]
-  (->> (d/q '[:find [(pull ?s [* {:shopping/list [:purchase-list/id]}]) ...]
+  (->> (d/q '[:find [(pull ?s [*]) ...]
               :in $ ?l-id [?a-l-id ...]
               :where
-              [?l :purchase-list/id ?l-id]
-              [?l :purchase-list/id ?a-l-id]
-              [?s :shopping/list ?l]
+              [?s :shopping/list-id ?l-id]
+              [?s :shopping/list-id ?a-l-id]
               [?s :shopping/status :in-progress]]
             (d/db connection) list-id allowed-lists-ids)
        (map adapter.shopping/db->internal)))
@@ -66,8 +67,7 @@
               :in $ ?id [?a-l-id ...]
               :where
               [?s :shopping/id ?id]
-              [?s :shopping/list ?l]
-              [?l :purchase-list/id ?a-l-id]]
+              [?s :shopping/list-id ?a-l-id]]
             (d/db connection) id allowed-lists-ids)
        ffirst
        adapter.shopping/db->internal))
diff --git a/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj b/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
index c5a3baa..b7e0bc8 100644
--- a/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/publishers/shopping.clj
@@ -1,5 +1,6 @@
 (ns purchase-listinator.modules.shopping.diplomat.publishers.shopping
   (:require
+    [purchase-listinator.components.rabbitmq-channel :as components.rabbitmq-channel]
     [schema.core :as s]
     [purchase-listinator.misc.date :as misc.date]
     [purchase-listinator.misc.general :as misc.general]
@@ -8,7 +9,8 @@
 
 (s/defn shopping-finished :- models.internal.shopping/Shopping
   [shopping :- models.internal.shopping/Shopping
-   {:keys [publish]}]
-  (publish :purchase-listinator/shopping.finished
-           (adapters.out.shopping/->ShoppingFinishedEvent shopping (misc.date/numb-now) (misc.general/squuid)))
+   producer :- components.rabbitmq-channel/IProducer]
+  (components.rabbitmq-channel/publish producer
+                                       :purchase-listinator/shopping.finished
+                                       (adapters.out.shopping/->ShoppingFinishedEvent shopping (misc.date/numb-now) (misc.general/squuid)))
   shopping)
diff --git a/src/purchase_listinator/modules/shopping/flows/shopping.clj b/src/purchase_listinator/modules/shopping/flows/shopping.clj
index 78b775e..bc671df 100644
--- a/src/purchase_listinator/modules/shopping/flows/shopping.clj
+++ b/src/purchase_listinator/modules/shopping/flows/shopping.clj
@@ -93,10 +93,10 @@
 (s/defn finish
   [shopping-id :- s/Uuid
    user-id :- s/Uuid
-   {:shopping/keys [main-db rabbitmq http]}]
+   {:shopping/keys [main-db rabbitmq-channel http]}]
   (let [allowed-lists-ids (http.client.shopping/get-allowed-lists user-id http)
         shopping (datomic.shopping/get-by-id shopping-id allowed-lists-ids main-db)
         shopping (finished-shopping user-id shopping http)]
     (datomic.shopping/upsert shopping main-db)
-    (publishers.shopping/shopping-finished shopping rabbitmq)))
+    (publishers.shopping/shopping-finished shopping rabbitmq-channel)))
 

From 877dd0d3f0ca60104b4e59c6ca6b41bee5cca86e Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Tue, 6 Aug 2024 22:38:12 -0300
Subject: [PATCH 4/8] fix: tests

---
 .../components/rabbitmq_channel.clj           | 21 ++++++++++++++++++-
 .../modules/shopping/core.clj                 |  6 ++++--
 .../shopping}/shopping_in_progress.clj        |  2 +-
 test/integration/utils/integration_test.clj   |  4 +++-
 .../logic/shopping_cart_event_test.clj        |  4 ++--
 5 files changed, 30 insertions(+), 7 deletions(-)
 rename test/integration/{purchase_list => modules/shopping}/shopping_in_progress.clj (98%)
 rename test/unit/purchase_listinator/{ => modules/shopping}/logic/shopping_cart_event_test.clj (96%)

diff --git a/src/purchase_listinator/components/rabbitmq_channel.clj b/src/purchase_listinator/components/rabbitmq_channel.clj
index 0e77269..3fb1233 100644
--- a/src/purchase_listinator/components/rabbitmq_channel.clj
+++ b/src/purchase_listinator/components/rabbitmq_channel.clj
@@ -51,4 +51,23 @@
 
 (defn new-rabbit-mq-channel
   [config-key]
-  (map->RabbitMqChannel {:config-key config-key}))
\ No newline at end of file
+  (map->RabbitMqChannel {:config-key config-key}))
+
+
+(defrecord RabbitMqChannelFake [config-key config]
+  component/Lifecycle
+  (start [this]
+    this)
+  (stop [this]
+   this)
+  IProducer
+  (publish
+    [producer exchange payload]
+    payload)
+  (publish
+    [producer exchange payload args]
+    payload))
+
+(defn new-rabbit-mq-channel-fake
+  [config-key]
+  (map->RabbitMqChannelFake {:config-key config-key}))
\ No newline at end of file
diff --git a/src/purchase_listinator/modules/shopping/core.clj b/src/purchase_listinator/modules/shopping/core.clj
index 381cab6..c04ec1c 100644
--- a/src/purchase_listinator/modules/shopping/core.clj
+++ b/src/purchase_listinator/modules/shopping/core.clj
@@ -26,15 +26,17 @@
   [db.mongo.shopping-location/indexes])
 
 (def components
-  {:shopping/http             (component/using (components.http/new-http :shopping/request-routes) [:config])
+  {:shopping/http             (component/using (components.http/new-http-mock) [:config])
    :shopping/main-db          (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
    :shopping/rabbitmq-channel (component/using (components.rabbitmq-channel/new-rabbit-mq-channel :shopping/rabbitmq) [:config])
    :shopping/rabbitmq         (component/using (components.rabbitmq/new-rabbit-mq-v2 :shopping/rabbitmq :shopping/rabbitmq-channel []) rabbitmq-dependencies)
    :shopping/mongo            (component/using (components.mongo/new-mongo :shopping/mongo mongo-indexes) [:config])})
 
 (def system-components-test
-  {:shopping/main-db  (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
+  {:shopping/http             (component/using (components.http/new-http :shopping/request-routes) [:config])
+   :shopping/main-db  (component/using (components.datahike/new-datahike :shopping/main-db schemas) [:config])
    :shopping/rabbitmq (component/using (components.rabbitmq/new-rabbit-mq-fake) rabbitmq-dependencies)
+   :shopping/rabbitmq-channel (component/using (components.rabbitmq-channel/new-rabbit-mq-channel-fake :shopping/rabbitmq) [:config])
    ;todo: fake mongo
    :shopping/mongo    (component/using (components.mongo/new-mongo-fake) [:config])})
 
diff --git a/test/integration/purchase_list/shopping_in_progress.clj b/test/integration/modules/shopping/shopping_in_progress.clj
similarity index 98%
rename from test/integration/purchase_list/shopping_in_progress.clj
rename to test/integration/modules/shopping/shopping_in_progress.clj
index 44d9a61..69c58cd 100644
--- a/test/integration/purchase_list/shopping_in_progress.clj
+++ b/test/integration/modules/shopping/shopping_in_progress.clj
@@ -1,4 +1,4 @@
-(ns purchase-list.shopping-in-progress
+(ns modules.shopping.shopping-in-progress
   (:require [clojure.test :refer :all]
             [purchase-listinator.wires.purchase-list.out.purchase-list :as wires.purchase-list.out.purchase-list]
             [state-flow.core :refer [flow]]
diff --git a/test/integration/utils/integration_test.clj b/test/integration/utils/integration_test.clj
index bfbd1ac..257c798 100644
--- a/test/integration/utils/integration_test.clj
+++ b/test/integration/utils/integration_test.clj
@@ -8,13 +8,15 @@
             [purchase-listinator.purchase-listinator-core :as purchase-listinator-core]
             [purchase-listinator.modules.events.core :as modules.events.core]
             [purchase-listinator.modules.price-suggestion.core :as modules.price-suggestion.core]
-            [purchase-listinator.modules.shopping-cart.core :as modules.shopping-cart.core]))
+            [purchase-listinator.modules.shopping-cart.core :as modules.shopping-cart.core]
+            [purchase-listinator.modules.shopping.core :as modules.shopping.core]))
 
 (def module-config-test
   [purchase-listinator-core/module-config-test
    modules.events.core/system-config-test
    modules.price-suggestion.core/system-config-test
    modules.shopping-cart.core/system-config-test
+   modules.shopping.core/system-config-test
    ])
 
 (defn system-config-test
diff --git a/test/unit/purchase_listinator/logic/shopping_cart_event_test.clj b/test/unit/purchase_listinator/modules/shopping/logic/shopping_cart_event_test.clj
similarity index 96%
rename from test/unit/purchase_listinator/logic/shopping_cart_event_test.clj
rename to test/unit/purchase_listinator/modules/shopping/logic/shopping_cart_event_test.clj
index 21c6802..a2aa2b9 100644
--- a/test/unit/purchase_listinator/logic/shopping_cart_event_test.clj
+++ b/test/unit/purchase_listinator/modules/shopping/logic/shopping_cart_event_test.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.logic.shopping-cart-event-test
+(ns purchase-listinator.modules.shopping.logic.shopping-cart-event-test
   (:require [clojure.test :refer :all]
-            [purchase-listinator.logic.shopping-cart-event :as logic.shopping-cart-event]
+            [purchase-listinator.modules.shopping.logic.shopping-cart-event :as logic.shopping-cart-event]
             [schema.test :as st]))
 
 (def purchase-list-id (random-uuid))

From 417e72d257dbfc606fe9a9793659a777b4bb5c20 Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Tue, 6 Aug 2024 22:41:20 -0300
Subject: [PATCH 5/8] fix: test

---
 .../modules/shopping/diplomat/http/client.clj                   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/purchase_listinator/modules/shopping/diplomat/http/client.clj b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
index 61dba08..0c206bd 100644
--- a/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
+++ b/src/purchase_listinator/modules/shopping/diplomat/http/client.clj
@@ -3,7 +3,7 @@
     [purchase-listinator.components.http :as components.http]
     [purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart]
     [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]
-    [purchase-listinator.wires.in.price-suggestion :as wires.in.price-suggestion]
+    [purchase-listinator.modules.shopping.schemas.wires.in.price-suggestion :as wires.in.price-suggestion]
     [purchase-listinator.modules.shopping.adapters.in.price-suggestion :as adapters.in.price-suggestion]
     [purchase-listinator.modules.shopping.schemas.wires.in.cart :as wires.in.cart]
     [purchase-listinator.modules.shopping.adapters.in.cart :as adapters.in.cart]

From 3c3f1c017786ebaf05a99628d6980e1c03a04e2d Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Wed, 7 Aug 2024 22:29:09 -0300
Subject: [PATCH 6/8] fix: test

---
 .../modules/shopping/adapters/in/price_suggestion.clj           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj b/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
index a3d9252..3372c5f 100644
--- a/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
+++ b/src/purchase_listinator/modules/shopping/adapters/in/price_suggestion.clj
@@ -1,6 +1,6 @@
 (ns purchase-listinator.modules.shopping.adapters.in.price-suggestion
   (:require [schema.core :as s]
-            [purchase-listinator.wires.in.price-suggestion :as wires.in.price-suggestion]
+            [purchase-listinator.modules.shopping.schemas.wires.in.price-suggestion :as wires.in.price-suggestion]
             [purchase-listinator.modules.shopping.schemas.models.price-suggestion :as models.internal.price-suggestion]))
 
 (s/defn wire->internal :- models.internal.price-suggestion/ShoppingItemSuggestedPrices

From 35a8a17b09d97b4a8541c217b000d514a09f0432 Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Wed, 7 Aug 2024 22:38:18 -0300
Subject: [PATCH 7/8] fix: namespaces

---
 src/purchase_listinator/components/datomic.clj | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/purchase_listinator/components/datomic.clj b/src/purchase_listinator/components/datomic.clj
index 234bb23..401c322 100644
--- a/src/purchase_listinator/components/datomic.clj
+++ b/src/purchase_listinator/components/datomic.clj
@@ -4,9 +4,6 @@
             [purchase-listinator.dbs.datomic.purchase-list :as datomic.purchase-list]
             [purchase-listinator.dbs.datomic.purchase-category :as datomic.purchase-category]
             [purchase-listinator.dbs.datomic.purchase-item :as datomic.purchase-item]
-            [purchase-listinator.dbs.datomic.shopping :as datomic.shopping]
-            [purchase-listinator.dbs.datomic.shopping-category :as dbs.datomic.shopping-category]
-            [purchase-listinator.dbs.datomic.shopping-item :as dbs.datomic.shopping-item]
             [purchase-listinator.dbs.datomic.user :as dbs.datomic.user]
             [purchase-listinator.dbs.datomic.share :as dbs.datomic.share]))
 

From 00a31b9418fc6829c3936b9540bf02369d7b210a Mon Sep 17 00:00:00 2001
From: gumberss <gustavomarinsuppi@gmail.com>
Date: Wed, 7 Aug 2024 22:42:31 -0300
Subject: [PATCH 8/8] fix: testsgit push

---
 .../adapters/in/shopping_initiation_data_request_test.clj     | 4 ++--
 .../shopping}/adapters/in/shopping_initiation_test.clj        | 4 ++--
 .../shopping}/adapters/out/shopping_initiation_data_test.clj  | 4 ++--
 .../{ => modules/shopping}/logic/purchase_category_test.clj   | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
 rename test/unit/purchase_listinator/{ => modules/shopping}/adapters/in/shopping_initiation_data_request_test.clj (70%)
 rename test/unit/purchase_listinator/{ => modules/shopping}/adapters/in/shopping_initiation_test.clj (80%)
 rename test/unit/purchase_listinator/{ => modules/shopping}/adapters/out/shopping_initiation_data_test.clj (62%)
 rename test/unit/purchase_listinator/{ => modules/shopping}/logic/purchase_category_test.clj (91%)

diff --git a/test/unit/purchase_listinator/adapters/in/shopping_initiation_data_request_test.clj b/test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request_test.clj
similarity index 70%
rename from test/unit/purchase_listinator/adapters/in/shopping_initiation_data_request_test.clj
rename to test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request_test.clj
index ac92ede..c9003ab 100644
--- a/test/unit/purchase_listinator/adapters/in/shopping_initiation_data_request_test.clj
+++ b/test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_data_request_test.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.adapters.in.shopping-initiation-data-request-test
+(ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation-data-request-test
   (:require [clojure.test :refer :all]
-            [purchase-listinator.adapters.in.shopping-initiation-data-request :as adapters.in.shopping-initiation-data-request]
+            [purchase-listinator.modules.shopping.adapters.in.shopping-initiation-data-request :as adapters.in.shopping-initiation-data-request]
             [schema.test :as s]))
 
 (def wire-shopping-initiation-data-request
diff --git a/test/unit/purchase_listinator/adapters/in/shopping_initiation_test.clj b/test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_test.clj
similarity index 80%
rename from test/unit/purchase_listinator/adapters/in/shopping_initiation_test.clj
rename to test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_test.clj
index a9082b4..87ae3de 100644
--- a/test/unit/purchase_listinator/adapters/in/shopping_initiation_test.clj
+++ b/test/unit/purchase_listinator/modules/shopping/adapters/in/shopping_initiation_test.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.adapters.in.shopping-initiation-test
+(ns purchase-listinator.modules.shopping.adapters.in.shopping-initiation-test
   (:require [clojure.test :refer :all]
-            [purchase-listinator.adapters.in.shopping-initiation :as adapters.in.shopping-initiation]
+            [purchase-listinator.modules.shopping.adapters.in.shopping-initiation :as adapters.in.shopping-initiation]
             [schema.test :as s]))
 
 (def wire-shopping-initiation
diff --git a/test/unit/purchase_listinator/adapters/out/shopping_initiation_data_test.clj b/test/unit/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data_test.clj
similarity index 62%
rename from test/unit/purchase_listinator/adapters/out/shopping_initiation_data_test.clj
rename to test/unit/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data_test.clj
index 177fe81..c533716 100644
--- a/test/unit/purchase_listinator/adapters/out/shopping_initiation_data_test.clj
+++ b/test/unit/purchase_listinator/modules/shopping/adapters/out/shopping_initiation_data_test.clj
@@ -1,6 +1,6 @@
-(ns purchase-listinator.adapters.out.shopping-initiation-data-test
+(ns purchase-listinator.modules.shopping.adapters.out.shopping-initiation-data-test
   (:require [clojure.test :refer :all]
-            [purchase-listinator.adapters.out.shopping-initiation-data :as adapters.out.shopping-initiation-data]
+            [purchase-listinator.modules.shopping.adapters.out.shopping-initiation-data :as adapters.out.shopping-initiation-data]
             [schema.test :as s]
             [fixtures.shopping]))
 
diff --git a/test/unit/purchase_listinator/logic/purchase_category_test.clj b/test/unit/purchase_listinator/modules/shopping/logic/purchase_category_test.clj
similarity index 91%
rename from test/unit/purchase_listinator/logic/purchase_category_test.clj
rename to test/unit/purchase_listinator/modules/shopping/logic/purchase_category_test.clj
index 7cbd8c1..659493b 100644
--- a/test/unit/purchase_listinator/logic/purchase_category_test.clj
+++ b/test/unit/purchase_listinator/modules/shopping/logic/purchase_category_test.clj
@@ -1,4 +1,4 @@
-(ns purchase-listinator.logic.purchase-category-test
+(ns purchase-listinator.modules.shopping.logic.purchase-category-test
   (:require [clojure.test :refer :all]
             [schema.test :as s]
             [purchase-listinator.logic.purchase-category :as logic.purchase-category]))
@@ -37,6 +37,6 @@
     (is (= category-with-items-ordered (logic.purchase-category/sort-items-by-position first-category)))))
 
 (s/deftest sort-by-position-test
-  (testing "Should order catgories by position"
+  (testing "Should order categories by position"
     (is (= [first-category second-category third-category]
            (logic.purchase-category/sort-by-position [third-category second-category first-category])))))