Skip to content

Commit

Permalink
fix(product-details): return vendor info on product details endpoint (#…
Browse files Browse the repository at this point in the history
…161)

- return vendor info on product details endpoint

[#Fixes #160]
  • Loading branch information
jkarenzi authored Jul 20, 2024
1 parent 9ab7eaf commit 189d16f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/controller/buyerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getOneProduct = errorHandler(

const product = await productRepository.findOne({
where: { id: productId },
relations: ['category','reviews','reviews.user'],
relations: ['category','reviews','reviews.user','vendor'],
});

if (!product) {
Expand Down
10 changes: 3 additions & 7 deletions src/controller/cartController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,11 @@ export const getCartItems = errorHandler(
async (req: Request, res: Response) => {
const userId = req.user!.id;

const user = await userRepository.findOne({
where: {
id: userId,
},
});

const cartItems = await cartRepository.find({
where: {
user: user!,
user: {
id: userId
},
},
select: {
user: {
Expand Down

0 comments on commit 189d16f

Please sign in to comment.