aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/my-notifications.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users/my-notifications.ts')
-rw-r--r--server/controllers/api/users/my-notifications.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index 76cf97587..bbafda5a6 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -9,7 +9,6 @@ import {
9 setDefaultSort, 9 setDefaultSort,
10 userNotificationsSortValidator 10 userNotificationsSortValidator
11} from '../../../middlewares' 11} from '../../../middlewares'
12import { UserModel } from '../../../models/account/user'
13import { getFormattedObjects } from '../../../helpers/utils' 12import { getFormattedObjects } from '../../../helpers/utils'
14import { UserNotificationModel } from '../../../models/account/user-notification' 13import { UserNotificationModel } from '../../../models/account/user-notification'
15import { meRouter } from './me' 14import { meRouter } from './me'
@@ -57,8 +56,8 @@ export {
57// --------------------------------------------------------------------------- 56// ---------------------------------------------------------------------------
58 57
59async function updateNotificationSettings (req: express.Request, res: express.Response) { 58async function updateNotificationSettings (req: express.Request, res: express.Response) {
60 const user: UserModel = res.locals.oauth.token.User 59 const user = res.locals.oauth.token.User
61 const body = req.body 60 const body = req.body as UserNotificationSetting
62 61
63 const query = { 62 const query = {
64 where: { 63 where: {
@@ -84,7 +83,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
84} 83}
85 84
86async function listUserNotifications (req: express.Request, res: express.Response) { 85async function listUserNotifications (req: express.Request, res: express.Response) {
87 const user: UserModel = res.locals.oauth.token.User 86 const user = res.locals.oauth.token.User
88 87
89 const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread) 88 const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread)
90 89
@@ -92,7 +91,7 @@ async function listUserNotifications (req: express.Request, res: express.Respons
92} 91}
93 92
94async function markAsReadUserNotifications (req: express.Request, res: express.Response) { 93async function markAsReadUserNotifications (req: express.Request, res: express.Response) {
95 const user: UserModel = res.locals.oauth.token.User 94 const user = res.locals.oauth.token.User
96 95
97 await UserNotificationModel.markAsRead(user.id, req.body.ids) 96 await UserNotificationModel.markAsRead(user.id, req.body.ids)
98 97
@@ -100,7 +99,7 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R
100} 99}
101 100
102async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { 101async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) {
103 const user: UserModel = res.locals.oauth.token.User 102 const user = res.locals.oauth.token.User
104 103
105 await UserNotificationModel.markAllAsRead(user.id) 104 await UserNotificationModel.markAllAsRead(user.id)
106 105