Skip to content

Commit

Permalink
Merge pull request #103 from atlp-rwanda/fixing-order-bug
Browse files Browse the repository at this point in the history
[Finishes bug] Fixing order bug
  • Loading branch information
niyontwali authored Jul 23, 2024
2 parents e9e74f8 + f701675 commit 7de4f4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/controllers/orderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
}
Expand All @@ -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);
Expand Down

0 comments on commit 7de4f4c

Please sign in to comment.