Skip to content

Commit

Permalink
164798024-feature(notification): update notification
Browse files Browse the repository at this point in the history
- edit variable names
  • Loading branch information
Anayo Oleru authored and Anayo Oleru committed Apr 24, 2019
1 parent 8e091d4 commit 98ed462
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions server/controllers/notification.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ const updateIsSeenColumn = async (req, res) => {
* @param {*} res
* @returns {object} All the notification belonging to the user
*/
const getAllNotification = async (req, res) => {
const getAllNotifications = async (req, res) => {
try {
const notification = await Notification.findAndCountAll({
const notifications = await Notification.findAndCountAll({
where: {
user_id: req.user.userObj.id,
is_seen: false,
},
});
if (!notification || notification.count === 0) {
if (!notifications || notifications.count === 0) {
return res.status(200).json({
message: "You don't have any notifications",
});
}
return res.status(200).json({
data: notification,
data: notifications,
});
} catch (err) {
return serverError;
Expand All @@ -67,7 +67,7 @@ const getAllNotification = async (req, res) => {

const notificationController = {
updateIsSeenColumn,
getAllNotification,
getAllNotifications,
};

export default notificationController;
2 changes: 1 addition & 1 deletion server/routes/notification.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ router.get(
router.get(
'/notifications',
tokenValidator.verifyToken,
updateIsSeenColumn.getAllNotification
updateIsSeenColumn.getAllNotifications
);

export default router;

0 comments on commit 98ed462

Please sign in to comment.