-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding the integration to shopping cart
- Loading branch information
Showing
13 changed files
with
99 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-4 Bytes
(100%)
...lient/migrations/scripts/__pycache__/003_insert_tick_shopping_items_prompt.cpython-39.pyc
Binary file not shown.
24 changes: 23 additions & 1 deletion
24
src/purchase_listinator/modules/shopping/adapters/in/cart.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
(ns purchase-listinator.modules.shopping.adapters.in.cart | ||
(:require | ||
[purchase-listinator.modules.shopping.schemas.models.cart :as models.internal.cart] | ||
[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] | ||
[purchase-listinator.modules.shopping.schemas.wires.in.cart :as wires.in.cart] | ||
[schema.core :as s])) | ||
|
||
(s/defn wire->internal :- models.internal.cart/Cart | ||
[wire :- wires.in.cart/Cart] | ||
wire) | ||
wire) | ||
|
||
(s/defn ^:private item->change-item-event :- internal.cart-events/ChangeItemEvent | ||
[{:keys [id quantity quantity-in-cart price ] } :- models.internal.shopping-list/ShoppingItem | ||
{:keys [purchase-list-id user-id ] :as shopping} :- models.internal.shopping-list/ShoppingList | ||
now :- s/Num] | ||
{:id id | ||
:moment now | ||
:event-type :change-item | ||
:user-id user-id | ||
:shopping-id (:id shopping) | ||
:item-id id | ||
:price price | ||
:quantity-changed (- quantity quantity-in-cart) | ||
:purchase-list-id purchase-list-id}) | ||
|
||
(s/defn items->change-item-event :- [internal.cart-events/ChangeItemEvent] | ||
[items :- [models.internal.shopping-list/ShoppingItem] | ||
shopping :- models.internal.shopping-list/ShoppingList | ||
now :- s/Num] | ||
(map #(item->change-item-event % shopping now) items)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
(ns purchase-listinator.modules.shopping.adapters.in.llm | ||
(:require | ||
[clojure.data.json :as json] | ||
[purchase-listinator.adapters.misc :as adapters.misc] | ||
[schema.core :as s] | ||
[purchase-listinator.modules.shopping.schemas.wires.in.llm :as shopping.schemas.wires.in.llm])) | ||
|
||
(s/defn wire->model :- [s/Uuid] | ||
[wire :- shopping.schemas.wires.in.llm/InteractionResponse] | ||
(when wire | ||
(-> (:response wire) | ||
(json/read-str)))) | ||
(->> (:response wire) | ||
(json/read-str) | ||
(map adapters.misc/string->uuid)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/purchase_listinator/modules/shopping/schemas/wires/out/shopping_cart_event.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(ns purchase-listinator.modules.shopping.schemas.wires.out.shopping-cart-event | ||
(:require [schema.core :as s])) | ||
|
||
(s/defschema ChangeItemEvent | ||
{:event-id s/Str | ||
:event-type s/Str | ||
:shopping-id s/Str | ||
:item-id s/Str | ||
:purchase-list-id s/Str | ||
:price s/Num | ||
:quantity-changed s/Int}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters