diff --git a/src/controller/buyerController.ts b/src/controller/buyerController.ts index 9a140f8..910b6a8 100644 --- a/src/controller/buyerController.ts +++ b/src/controller/buyerController.ts @@ -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) { diff --git a/src/controller/cartController.ts b/src/controller/cartController.ts index 91ca808..0022e36 100644 --- a/src/controller/cartController.ts +++ b/src/controller/cartController.ts @@ -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: {