-
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.
Merge pull request #50 from akhilome/ft-update-order-status-160870247
#160870247 Admin can update the status of an existing order
- Loading branch information
Showing
17 changed files
with
125 additions
and
260 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const formatOrders = (orders) => { | ||
const formattedOrder = orders.map((foundOrder) => { | ||
const formatted = { | ||
id: foundOrder.id, | ||
author: foundOrder.name, | ||
title: foundOrder.food_name, | ||
date: foundOrder.date, | ||
status: foundOrder.status, | ||
}; | ||
return formatted; | ||
}); | ||
|
||
return formattedOrder; | ||
}; | ||
|
||
export default formatOrders; |
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 was deleted.
Oops, something went wrong.
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,12 +1,27 @@ | ||
import { Router } from 'express'; | ||
import AuthHandler from '../middleware/authHandler'; | ||
import OrderController from '../controllers/orderController'; | ||
import Sanitize from '../middleware/sanitizer'; | ||
|
||
const router = new Router(); | ||
|
||
router.get('/users/:id/orders', AuthHandler.authorize, OrderController.getAllUserOrders); | ||
router.post('/orders', AuthHandler.authorize, OrderController.newOrder); | ||
router.get('/orders', AuthHandler.authorize, AuthHandler.authorizeAdmin, OrderController.getAllOrders); | ||
router.get('/orders/:id', AuthHandler.authorize, AuthHandler.authorizeAdmin, OrderController.getOrder); | ||
|
||
router.get( | ||
'/orders/:id', | ||
AuthHandler.authorize, | ||
AuthHandler.authorizeAdmin, | ||
OrderController.getOrder, | ||
); | ||
|
||
router.put( | ||
'/orders/:id', | ||
AuthHandler.authorize, | ||
AuthHandler.authorizeAdmin, | ||
Sanitize.updateStatus, | ||
OrderController.updateOrder, | ||
); | ||
|
||
export default router; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.