diff options
Diffstat (limited to 'server/controllers/api/v1/pods.js')
-rw-r--r-- | server/controllers/api/v1/pods.js | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index 8ffade578..2f4621327 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js | |||
@@ -1,6 +1,5 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const each = require('async/each') | ||
4 | const express = require('express') | 3 | const express = require('express') |
5 | const mongoose = require('mongoose') | 4 | const mongoose = require('mongoose') |
6 | const waterfall = require('async/waterfall') | 5 | const waterfall = require('async/waterfall') |
@@ -17,7 +16,6 @@ const signatureValidator = middlewares.validators.remote.signature | |||
17 | 16 | ||
18 | const router = express.Router() | 17 | const router = express.Router() |
19 | const Pod = mongoose.model('Pod') | 18 | const Pod = mongoose.model('Pod') |
20 | const Video = mongoose.model('Video') | ||
21 | 19 | ||
22 | router.get('/', listPods) | 20 | router.get('/', listPods) |
23 | router.post('/', | 21 | router.post('/', |
@@ -117,27 +115,7 @@ function removePods (req, res, next) { | |||
117 | }, | 115 | }, |
118 | 116 | ||
119 | function removePod (pod, callback) { | 117 | function removePod (pod, callback) { |
120 | pod.remove(function (err) { | 118 | pod.remove(callback) |
121 | // Be sure we only return one argument in the callback | ||
122 | return callback(err) | ||
123 | }) | ||
124 | }, | ||
125 | |||
126 | function (callback) { | ||
127 | Video.listByUrls([ url ], function (err, videosList) { | ||
128 | if (err) { | ||
129 | logger.error('Cannot list videos from url.', { error: err }) | ||
130 | return callback(err) | ||
131 | } | ||
132 | |||
133 | return callback(null, videosList) | ||
134 | }) | ||
135 | }, | ||
136 | |||
137 | function removeTheRemoteVideos (videosList, callback) { | ||
138 | each(videosList, function (video, callbackEach) { | ||
139 | video.remove(callbackEach) | ||
140 | }, callback) | ||
141 | } | 119 | } |
142 | ], function (err) { | 120 | ], function (err) { |
143 | if (err) return next(err) | 121 | if (err) return next(err) |