aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/rate.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/controllers/api/videos/rate.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip
Type functions
Diffstat (limited to 'server/controllers/api/videos/rate.ts')
-rw-r--r--server/controllers/api/videos/rate.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 1bc575675..afdd099f8 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,4 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as Sequelize from 'sequelize'
2import { waterfall } from 'async' 3import { waterfall } from 'async'
3 4
4import { database as db } from '../../../initializers/database' 5import { database as db } from '../../../initializers/database'
@@ -39,7 +40,7 @@ export {
39 40
40// --------------------------------------------------------------------------- 41// ---------------------------------------------------------------------------
41 42
42function rateVideoRetryWrapper (req, res, next) { 43function rateVideoRetryWrapper (req: express.Request, res: express.Response, next: express.NextFunction) {
43 const options = { 44 const options = {
44 arguments: [ req, res ], 45 arguments: [ req, res ],
45 errorMessage: 'Cannot update the user video rate.' 46 errorMessage: 'Cannot update the user video rate.'
@@ -52,7 +53,7 @@ function rateVideoRetryWrapper (req, res, next) {
52 }) 53 })
53} 54}
54 55
55function rateVideo (req, res, finalCallback) { 56function rateVideo (req: express.Request, res: express.Response, finalCallback: (err: Error) => void) {
56 const rateType = req.body.rating 57 const rateType = req.body.rating
57 const videoInstance = res.locals.video 58 const videoInstance = res.locals.video
58 const userInstance = res.locals.oauth.token.User 59 const userInstance = res.locals.oauth.token.User
@@ -168,7 +169,7 @@ function rateVideo (req, res, finalCallback) {
168 169
169 commitTransaction 170 commitTransaction
170 171
171 ], function (err, t) { 172 ], function (err: Error, t: Sequelize.Transaction) {
172 if (err) { 173 if (err) {
173 // This is just a debug because we will retry the insert 174 // This is just a debug because we will retry the insert
174 logger.debug('Cannot add the user video rate.', { error: err }) 175 logger.debug('Cannot add the user video rate.', { error: err })