aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/pods.ts4
-rw-r--r--server/middlewares/validators/users.ts6
-rw-r--r--server/middlewares/validators/videos.ts22
3 files changed, 16 insertions, 16 deletions
diff --git a/server/middlewares/validators/pods.ts b/server/middlewares/validators/pods.ts
index 022fd7f9a..481a66957 100644
--- a/server/middlewares/validators/pods.ts
+++ b/server/middlewares/validators/pods.ts
@@ -18,7 +18,7 @@ function makeFriendsValidator (req: express.Request, res: express.Response, next
18 18
19 logger.debug('Checking makeFriends parameters', { parameters: req.body }) 19 logger.debug('Checking makeFriends parameters', { parameters: req.body })
20 20
21 checkErrors(req, res, function () { 21 checkErrors(req, res, () => {
22 hasFriends() 22 hasFriends()
23 .then(heHasFriends => { 23 .then(heHasFriends => {
24 if (heHasFriends === true) { 24 if (heHasFriends === true) {
@@ -41,7 +41,7 @@ function podsAddValidator (req: express.Request, res: express.Response, next: ex
41 req.checkBody('publicKey', 'Should have a public key').notEmpty() 41 req.checkBody('publicKey', 'Should have a public key').notEmpty()
42 logger.debug('Checking podsAdd parameters', { parameters: req.body }) 42 logger.debug('Checking podsAdd parameters', { parameters: req.body })
43 43
44 checkErrors(req, res, function () { 44 checkErrors(req, res, () => {
45 db.Pod.loadByHost(req.body.host) 45 db.Pod.loadByHost(req.body.host)
46 .then(pod => { 46 .then(pod => {
47 // Pod with this host already exists 47 // Pod with this host already exists
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index 90a46752c..38f8aed5b 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -15,7 +15,7 @@ function usersAddValidator (req: express.Request, res: express.Response, next: e
15 15
16 logger.debug('Checking usersAdd parameters', { parameters: req.body }) 16 logger.debug('Checking usersAdd parameters', { parameters: req.body })
17 17
18 checkErrors(req, res, function () { 18 checkErrors(req, res, () => {
19 db.User.loadByUsernameOrEmail(req.body.username, req.body.email) 19 db.User.loadByUsernameOrEmail(req.body.username, req.body.email)
20 .then(user => { 20 .then(user => {
21 if (user) return res.status(409).send('User already exists.') 21 if (user) return res.status(409).send('User already exists.')
@@ -34,7 +34,7 @@ function usersRemoveValidator (req: express.Request, res: express.Response, next
34 34
35 logger.debug('Checking usersRemove parameters', { parameters: req.params }) 35 logger.debug('Checking usersRemove parameters', { parameters: req.params })
36 36
37 checkErrors(req, res, function () { 37 checkErrors(req, res, () => {
38 db.User.loadById(req.params.id) 38 db.User.loadById(req.params.id)
39 .then(user => { 39 .then(user => {
40 if (!user) return res.status(404).send('User not found') 40 if (!user) return res.status(404).send('User not found')
@@ -66,7 +66,7 @@ function usersVideoRatingValidator (req: express.Request, res: express.Response,
66 66
67 logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) 67 logger.debug('Checking usersVideoRating parameters', { parameters: req.params })
68 68
69 checkErrors(req, res, function () { 69 checkErrors(req, res, () => {
70 let videoPromise: Promise<VideoInstance> 70 let videoPromise: Promise<VideoInstance>
71 71
72 if (validator.isUUID(req.params.videoId)) { 72 if (validator.isUUID(req.params.videoId)) {
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts
index 0a88e064e..bd223a1cb 100644
--- a/server/middlewares/validators/videos.ts
+++ b/server/middlewares/validators/videos.ts
@@ -23,7 +23,7 @@ function videosAddValidator (req: express.Request, res: express.Response, next:
23 23
24 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files }) 24 logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
25 25
26 checkErrors(req, res, function () { 26 checkErrors(req, res, () => {
27 const videoFile = req.files.videofile[0] 27 const videoFile = req.files.videofile[0]
28 28
29 db.Video.getDurationFromFile(videoFile.path) 29 db.Video.getDurationFromFile(videoFile.path)
@@ -54,8 +54,8 @@ function videosUpdateValidator (req: express.Request, res: express.Response, nex
54 54
55 logger.debug('Checking videosUpdate parameters', { parameters: req.body }) 55 logger.debug('Checking videosUpdate parameters', { parameters: req.body })
56 56
57 checkErrors(req, res, function () { 57 checkErrors(req, res, () => {
58 checkVideoExists(req.params.id, res, function () { 58 checkVideoExists(req.params.id, res, () => {
59 // We need to make additional checks 59 // We need to make additional checks
60 if (res.locals.video.isOwned() === false) { 60 if (res.locals.video.isOwned() === false) {
61 return res.status(403).send('Cannot update video of another pod') 61 return res.status(403).send('Cannot update video of another pod')
@@ -75,7 +75,7 @@ function videosGetValidator (req: express.Request, res: express.Response, next:
75 75
76 logger.debug('Checking videosGet parameters', { parameters: req.params }) 76 logger.debug('Checking videosGet parameters', { parameters: req.params })
77 77
78 checkErrors(req, res, function () { 78 checkErrors(req, res, () => {
79 checkVideoExists(req.params.id, res, next) 79 checkVideoExists(req.params.id, res, next)
80 }) 80 })
81} 81}
@@ -85,12 +85,12 @@ function videosRemoveValidator (req: express.Request, res: express.Response, nex
85 85
86 logger.debug('Checking videosRemove parameters', { parameters: req.params }) 86 logger.debug('Checking videosRemove parameters', { parameters: req.params })
87 87
88 checkErrors(req, res, function () { 88 checkErrors(req, res, () => {
89 checkVideoExists(req.params.id, res, function () { 89 checkVideoExists(req.params.id, res, () => {
90 // We need to make additional checks 90 // We need to make additional checks
91 91
92 // Check if the user who did the request is able to delete the video 92 // Check if the user who did the request is able to delete the video
93 checkUserCanDeleteVideo(res.locals.oauth.token.User.id, res, function () { 93 checkUserCanDeleteVideo(res.locals.oauth.token.User.id, res, () => {
94 next() 94 next()
95 }) 95 })
96 }) 96 })
@@ -113,7 +113,7 @@ function videoAbuseReportValidator (req: express.Request, res: express.Response,
113 113
114 logger.debug('Checking videoAbuseReport parameters', { parameters: req.body }) 114 logger.debug('Checking videoAbuseReport parameters', { parameters: req.body })
115 115
116 checkErrors(req, res, function () { 116 checkErrors(req, res, () => {
117 checkVideoExists(req.params.id, res, next) 117 checkVideoExists(req.params.id, res, next)
118 }) 118 })
119} 119}
@@ -124,7 +124,7 @@ function videoRateValidator (req: express.Request, res: express.Response, next:
124 124
125 logger.debug('Checking videoRate parameters', { parameters: req.body }) 125 logger.debug('Checking videoRate parameters', { parameters: req.body })
126 126
127 checkErrors(req, res, function () { 127 checkErrors(req, res, () => {
128 checkVideoExists(req.params.id, res, next) 128 checkVideoExists(req.params.id, res, next)
129 }) 129 })
130} 130}
@@ -134,8 +134,8 @@ function videosBlacklistValidator (req: express.Request, res: express.Response,
134 134
135 logger.debug('Checking videosBlacklist parameters', { parameters: req.params }) 135 logger.debug('Checking videosBlacklist parameters', { parameters: req.params })
136 136
137 checkErrors(req, res, function () { 137 checkErrors(req, res, () => {
138 checkVideoExists(req.params.id, res, function () { 138 checkVideoExists(req.params.id, res, () => {
139 checkVideoIsBlacklistable(req, res, next) 139 checkVideoIsBlacklistable(req, res, next)
140 }) 140 })
141 }) 141 })