diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
commit | dae86118ed5d4026d04acb9d0e36829b9ad8eb4e (patch) | |
tree | a5bf9c4487240bf75a9b328cad459a0587f90dea /server/controllers/api/users/my-notifications.ts | |
parent | e65c0c5b1fab9c3d93f51721b2458cf5cf471f20 (diff) | |
download | PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.gz PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.zst PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.zip |
Cleanup express locals typings
Diffstat (limited to 'server/controllers/api/users/my-notifications.ts')
-rw-r--r-- | server/controllers/api/users/my-notifications.ts | 11 |
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' |
12 | import { UserModel } from '../../../models/account/user' | ||
13 | import { getFormattedObjects } from '../../../helpers/utils' | 12 | import { getFormattedObjects } from '../../../helpers/utils' |
14 | import { UserNotificationModel } from '../../../models/account/user-notification' | 13 | import { UserNotificationModel } from '../../../models/account/user-notification' |
15 | import { meRouter } from './me' | 14 | import { meRouter } from './me' |
@@ -57,8 +56,8 @@ export { | |||
57 | // --------------------------------------------------------------------------- | 56 | // --------------------------------------------------------------------------- |
58 | 57 | ||
59 | async function updateNotificationSettings (req: express.Request, res: express.Response) { | 58 | async 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 | ||
86 | async function listUserNotifications (req: express.Request, res: express.Response) { | 85 | async 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 | ||
94 | async function markAsReadUserNotifications (req: express.Request, res: express.Response) { | 93 | async 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 | ||
102 | async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { | 101 | async 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 | ||