-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3074-refactored notifications to separate router
- Loading branch information
1 parent
fd4f299
commit 0673cdf
Showing
16 changed files
with
197 additions
and
182 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import express from 'express'; | ||
import NotificationsController from '../controllers/notifications.controllers'; | ||
import { nonEmptyString } from '../utils/validation.utils'; | ||
import { body } from 'express-validator'; | ||
|
||
const notificationsRouter = express.Router(); | ||
|
||
notificationsRouter.post('/task-deadlines', NotificationsController.sendDailySlackNotifications); | ||
notificationsRouter.get('/current-user', NotificationsController.getUserUnreadNotifications); | ||
notificationsRouter.post( | ||
'/curent-user/remove', | ||
nonEmptyString(body('notificationId')), | ||
NotificationsController.removeUserNotification | ||
); | ||
|
||
export default notificationsRouter; |
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import axios from 'axios'; | ||
import { apiUrls } from '../utils/urls'; | ||
import { Notification } from 'shared'; | ||
|
||
/* | ||
* Gets all unread notifications of the user with the given id | ||
*/ | ||
export const getNotifications = () => { | ||
return axios.get<Notification[]>(apiUrls.notificationsCurrentUser(), { | ||
transformResponse: (data) => JSON.parse(data) | ||
}); | ||
}; | ||
|
||
/* | ||
* Removes a notification from the user with the given id | ||
*/ | ||
export const removeNotification = (notificationId: string) => { | ||
return axios.post<Notification[]>(apiUrls.notificationsRemoveCurrentUser(), { notificationId }); | ||
}; |
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
Oops, something went wrong.