Skip to content

Commit

Permalink
Merge b91054e into ae1c49e
Browse files Browse the repository at this point in the history
  • Loading branch information
segunolalive committed Oct 18, 2017
2 parents ae1c49e + b91054e commit f2d0225
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion server/controllers/transactionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import { Notification } from '../models';
* @param {object} req - express http request object
* @param {object} res - express http response object
* @param {Bool} history - optional arguement indicating user history
* @param {Bool} admin - optional arguement indicating admin status
* @return {object} - express http response object
*/
export default (req, res, history) => {
export default (req, res, history, admin) => {
const options = { order: [['id', 'DESC']] };
if (history) {
options.where = { username: req.user.username };
}
if (admin) {
delete options.where;
}
Notification.findAll(options)
.then(notifications => (
res.status(200).send({
Expand Down
2 changes: 1 addition & 1 deletion server/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ router.get('/api/v1', (req, res) => res.status(200).send({
'/api/v1/admin-notifications',
authenticate,
ensureIsAdmin,
transactionController
(req, res) => transactionController(req, res, false, true)
)
// Send a message if route does not exist
.get('/api*', (req, res) => res.status(404).send({
Expand Down

0 comments on commit f2d0225

Please sign in to comment.