Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
feat(basket): clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatole-Godard committed Aug 14, 2023
1 parent e81046f commit c3d11fd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion services/basket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- `AddProduct`: Adds a product to a basket.
- `DeleteProduct`: Deletes a product from a basket.
- `Reset`: Resets a basket.
- `SetRestaurant`: Sets a restaurant to a basket.
- `UpdateRestaurant`: Sets a restaurant to a basket.

## Requirements

Expand Down
3 changes: 0 additions & 3 deletions services/basket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
"dependencies": {
"@grpc/grpc-js": "^1.8.13",
"@grpc/proto-loader": "0.7.6",
"@prisma/client": "4.16.2",
"amqplib": "^0.10.3",
"dotenv": "^16.0.3",
"prisma-redis-middleware": "4.8.0",
"protobufjs": "7.2.2",
"redis": "^4.6.7"
},
Expand All @@ -26,7 +24,6 @@
"esbuild": "^0.17.14",
"nodemon": "^2.0.22",
"pkg": "^5.8.1",
"prisma": "4.16.2",
"ts-node": "10.9.1",
"tsconfig-paths": "^4.1.2",
"typescript": "5.0.2",
Expand Down
1 change: 0 additions & 1 deletion services/basket/src/handlers/basket/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const DeleteProduct = async (
products_ids: storedBasket.products_ids.filter(productId => productId !== product_id),
restaurant_id: storedBasket.restaurant_id
};
log.info(basket);
await client.set(`user:${user_id}`, JSON.stringify(newBasket));
callback(null, {user_id, ...newBasket});
} catch (error) {
Expand Down
5 changes: 2 additions & 3 deletions services/basket/src/handlers/basket/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ export const GetBasket = async (
if (!basket) {
callback(null, {});
} else {
const {products_ids, restaurant_id}: RedisBasket = JSON.parse(basket);
const storedBasket: RedisBasket = JSON.parse(basket);
callback(null, {
user_id: id,
products_ids,
restaurant_id
...storedBasket
});
}
} catch (error) {
Expand Down

0 comments on commit c3d11fd

Please sign in to comment.