Skip to content

Commit

Permalink
Merge pull request #85 from fdhhhdjd/backend-#84
Browse files Browse the repository at this point in the history
#84 Backend
  • Loading branch information
fdhhhdjd committed Oct 18, 2022
2 parents babf584 + d7e8c7f commit 7010a22
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@

- Get all category : get --> http://localhost:5000/api/user/category

## Carousels

- Get all carousel : get --> http://localhost:5000/api/carousel

## Carts

- Add to cart : post --> http://localhost:5000/api/product/add/cart
Expand All @@ -209,7 +213,7 @@

- Get all product: get --> http://localhost:5000/api/product

- Get Product detail : get --> http://localhost:5000/api/review/create/:id
- Get Product detail : get --> http://localhost:5000/api/product/detail/:id

## Reviews

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const {
getallProductUserDetail,
} = require("./getproduct.service");
const Products = require("../../../models/ProductModel");
const {
handleGetCommentProductId,
} = require("../review.service/review.service");
module.exports = {
HandleGetProduct: async () => {
const products = await getallProductUser();
Expand All @@ -26,7 +29,10 @@ module.exports = {
return {
status: 200,
success: true,
element: product_detail,
element: {
product_detail,
comment: await handleGetCommentProductId(product_id),
},
};
},
handleAddToCart: async ({ user_id, product_id, quantity }) => {
Expand Down
11 changes: 11 additions & 0 deletions backend/src/v1/user_api/services/review.service/review.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,15 @@ module.exports = {
},
};
},
handleGetCommentProductId: async (product_id) => {
return await Products.findById(product_id)
.populate({
path: "reviews",
populate: {
path: "user",
select: { name: 1, email: 1, image: 1 },
},
})
.select("reviews");
},
};
Binary file modified dump.rdb
Binary file not shown.

0 comments on commit 7010a22

Please sign in to comment.