-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[finsihes 187354259] added endpoint to get all products
added end point to get one product added end point for a seller to delete a product from a his collection
- Loading branch information
Munezero Ange
committed
May 8, 2024
1 parent
608d497
commit 4f50cad
Showing
5 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
/* eslint-disable @typescript-eslint/no-misused-promises */ | ||
import express from 'express'; | ||
import { createProduct, createSize } from '../controllers/productsController'; | ||
import { Router } from 'express'; | ||
import { createProduct, createSize, getAllProduct, getProductById } from '../controllers/productsController'; | ||
import multerUpload from '../helpers/multer'; | ||
import { checkUserRoles, isAuthenticated } from '../middlewares/authMiddlewares'; | ||
|
||
export const productRouter = express.Router(); | ||
const router = Router(); | ||
|
||
productRouter.post( | ||
router.post( | ||
'/:categoryId/create-product/', | ||
isAuthenticated, | ||
checkUserRoles('seller'), | ||
multerUpload.array('images', 8), | ||
createProduct | ||
); | ||
|
||
productRouter.post('/:productId/add-size', isAuthenticated, checkUserRoles('seller'), createSize); | ||
router.post('/:productId/add-size', isAuthenticated, checkUserRoles('seller'), createSize); | ||
|
||
router.get('/', getAllProduct); | ||
router.get('/:productId', getProductById); | ||
|
||
export default router; |