Skip to content

Commit

Permalink
feat(role): add adminAccess middleware to protected endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
zulfikarrosadi committed Nov 15, 2024
1 parent 0c57f68 commit a883c8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AuthHandler from './auth/handler'
import AuthRepository from './auth/repository'
import AuthService from './auth/service'
import multer from './lib/upload'
import adminAccess from './middlewares/adminAccess'
import formDataParse from './middlewares/formDataParser'
import ProductHandler from './product/handler'
import ProductRepository from './product/repository'
Expand Down Expand Up @@ -46,13 +47,15 @@ router.get('/users', userHandler.getCurrentUser)
router.post(
'/products',
formDataParse(multer.array('images', 5)),
adminAccess,
validateInput(createProduct),
productHandler.createProduct,
)
router.get('/products', productHandler.getProducts)
router.put(
'/products/:id',
formDataParse(multer.array('images', 5)),
adminAccess,
validateInput(updateProduct),
productHandler.updateProductById,
)
Expand Down

0 comments on commit a883c8c

Please # to comment.