From f701675ce1230d67cafe1a96e4949d60022ee5c6 Mon Sep 17 00:00:00 2001 From: Rwirangira <142627846+P-Rwirangira@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:21:44 +0200 Subject: [PATCH] [Finishes bug] Fixing order bug --- src/controllers/orderController.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/orderController.ts b/src/controllers/orderController.ts index 86c11fb1..ae84a70f 100644 --- a/src/controllers/orderController.ts +++ b/src/controllers/orderController.ts @@ -127,6 +127,7 @@ export const getUserOrders = async (req: Request, res: Response) => { return sendInternalErrorResponse(res, err); } }; + export const sellerProductOrders = async (req: Request, res: Response) => { try { const { id } = req.user as User; @@ -143,8 +144,14 @@ export const sellerProductOrders = async (req: Request, res: Response) => { }, ], }, + { + model: User, + as: 'user', + attributes: ['id', 'firstName', 'lastName'], + }, ], }); + if (!orders) { return sendErrorResponse(res, 'No orders found'); } @@ -159,7 +166,6 @@ export const sellerProductOrders = async (req: Request, res: Response) => { return sendInternalErrorResponse(res, err); } }; - export const deleteOrder = async (req: Request, res: Response) => { try { const order = await Order.findByPk(req.params.id);