Skip to content

Commit

Permalink
Finishes fixes (#116)
Browse files Browse the repository at this point in the history
* Finishes fixes

* --ammend
  • Loading branch information
ndahimana154 authored Aug 5, 2024
1 parent 5b35243 commit f2292aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/modules/cart/controller/cartControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ const buyerUpdateCartStatus = async (req, res) => {
const updatedCart = await cartRepositories.getCartByUserIdAndCartId(req.user.id, cartId)
return res.status(httpStatus.OK).json({ status: httpStatus.OK, message: "Cart status updated successfully", data: { updatedCart } })
} catch (error) {
console.log(error.message)
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ status: httpStatus.INTERNAL_SERVER_ERROR, message: error.message })
}
}
Expand All @@ -417,10 +418,13 @@ const userCreateOrder = (req, res) => {
const order = cartRepositories.userSaveOrder(body)
return res.status(httpStatus.CREATED).json({ status: httpStatus.CREATED, message: "Order created succesfully", data: { order } })
} catch (error) {
console.log(error.message)
return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ status: httpStatus.INTERNAL_SERVER_ERROR, message: error.message })
}
}



export {
buyerGetCart,
buyerGetCarts,
Expand Down
3 changes: 2 additions & 1 deletion src/routes/cartRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ router.post(
router.get(
"/buyer-get-carts",
userAuthorization(["buyer"]),
isCartExist,
cartControllers.buyerGetCarts
);

Expand Down Expand Up @@ -79,5 +78,7 @@ router.get("/buyer-get-orders-history", userAuthorization(["buyer"]), isOrdersEx

router.post("/create-stripe-product", userAuthorization(["buyer"]), validation(productDetailsSchema), stripeCreateProduct);
router.post("/checkout-stripe-session", userAuthorization(["buyer"]), validation(checkoutSessionSchema), stripeCheckoutSession);
router.post("/user-create-order",userAuthorization(["buyer"]), cartControllers.userCreateOrder)
router.put("/update-cart-status",userAuthorization(["buyer"]), cartControllers.buyerUpdateCartStatus)

export default router;

0 comments on commit f2292aa

Please sign in to comment.