aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/me.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users/me.ts')
-rw-r--r--server/controllers/api/users/me.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index d5e154869..3533499be 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -93,8 +93,8 @@ export {
93 93
94// --------------------------------------------------------------------------- 94// ---------------------------------------------------------------------------
95 95
96async function getUserVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 96async function getUserVideos (req: express.Request, res: express.Response) {
97 const user = res.locals.oauth.token.User as UserModel 97 const user = res.locals.oauth.token.User
98 const resultList = await VideoModel.listUserVideosForApi( 98 const resultList = await VideoModel.listUserVideosForApi(
99 user.Account.id, 99 user.Account.id,
100 req.query.start as number, 100 req.query.start as number,
@@ -111,8 +111,8 @@ async function getUserVideos (req: express.Request, res: express.Response, next:
111 return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes })) 111 return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes }))
112} 112}
113 113
114async function getUserVideoImports (req: express.Request, res: express.Response, next: express.NextFunction) { 114async function getUserVideoImports (req: express.Request, res: express.Response) {
115 const user = res.locals.oauth.token.User as UserModel 115 const user = res.locals.oauth.token.User
116 const resultList = await VideoImportModel.listUserVideoImportsForApi( 116 const resultList = await VideoImportModel.listUserVideoImportsForApi(
117 user.id, 117 user.id,
118 req.query.start as number, 118 req.query.start as number,
@@ -123,14 +123,14 @@ async function getUserVideoImports (req: express.Request, res: express.Response,
123 return res.json(getFormattedObjects(resultList.data, resultList.total)) 123 return res.json(getFormattedObjects(resultList.data, resultList.total))
124} 124}
125 125
126async function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) { 126async function getUserInformation (req: express.Request, res: express.Response) {
127 // We did not load channels in res.locals.user 127 // We did not load channels in res.locals.user
128 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username) 128 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
129 129
130 return res.json(user.toFormattedJSON()) 130 return res.json(user.toFormattedJSON())
131} 131}
132 132
133async function getUserVideoQuotaUsed (req: express.Request, res: express.Response, next: express.NextFunction) { 133async function getUserVideoQuotaUsed (req: express.Request, res: express.Response) {
134 // We did not load channels in res.locals.user 134 // We did not load channels in res.locals.user
135 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username) 135 const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
136 const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user) 136 const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user)
@@ -143,7 +143,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
143 return res.json(data) 143 return res.json(data)
144} 144}
145 145
146async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { 146async function getUserVideoRating (req: express.Request, res: express.Response) {
147 const videoId = res.locals.video.id 147 const videoId = res.locals.video.id
148 const accountId = +res.locals.oauth.token.User.Account.id 148 const accountId = +res.locals.oauth.token.User.Account.id
149 149
@@ -158,7 +158,7 @@ async function getUserVideoRating (req: express.Request, res: express.Response,
158} 158}
159 159
160async function deleteMe (req: express.Request, res: express.Response) { 160async function deleteMe (req: express.Request, res: express.Response) {
161 const user: UserModel = res.locals.oauth.token.User 161 const user = res.locals.oauth.token.User
162 162
163 await user.destroy() 163 await user.destroy()
164 164
@@ -170,7 +170,7 @@ async function deleteMe (req: express.Request, res: express.Response) {
170async function updateMe (req: express.Request, res: express.Response) { 170async function updateMe (req: express.Request, res: express.Response) {
171 const body: UserUpdateMe = req.body 171 const body: UserUpdateMe = req.body
172 172
173 const user: UserModel = res.locals.oauth.token.user 173 const user = res.locals.oauth.token.user
174 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 174 const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
175 175
176 if (body.password !== undefined) user.password = body.password 176 if (body.password !== undefined) user.password = body.password
@@ -199,7 +199,7 @@ async function updateMe (req: express.Request, res: express.Response) {
199 199
200async function updateMyAvatar (req: express.Request, res: express.Response) { 200async function updateMyAvatar (req: express.Request, res: express.Response) {
201 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ] 201 const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
202 const user: UserModel = res.locals.oauth.token.user 202 const user = res.locals.oauth.token.user
203 const oldUserAuditView = new UserAuditView(user.toFormattedJSON()) 203 const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
204 204
205 const userAccount = await AccountModel.load(user.Account.id) 205 const userAccount = await AccountModel.load(user.Account.id)