aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/v1/pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-10-21 11:20:45 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-10-21 11:20:45 +0200
commit80a6c9e76fda57f01e37fe4620771ae70738a211 (patch)
tree7381a94285c11d954efca2be8103c8b86df3e832 /server/controllers/api/v1/pods.js
parent792b893ed414301c060391ed8a00368d68688236 (diff)
downloadPeerTube-80a6c9e76fda57f01e37fe4620771ae70738a211.tar.gz
PeerTube-80a6c9e76fda57f01e37fe4620771ae70738a211.tar.zst
PeerTube-80a6c9e76fda57f01e37fe4620771ae70738a211.zip
Server: pod removing refractoring
Diffstat (limited to 'server/controllers/api/v1/pods.js')
-rw-r--r--server/controllers/api/v1/pods.js24
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
3const each = require('async/each')
4const express = require('express') 3const express = require('express')
5const mongoose = require('mongoose') 4const mongoose = require('mongoose')
6const waterfall = require('async/waterfall') 5const waterfall = require('async/waterfall')
@@ -17,7 +16,6 @@ const signatureValidator = middlewares.validators.remote.signature
17 16
18const router = express.Router() 17const router = express.Router()
19const Pod = mongoose.model('Pod') 18const Pod = mongoose.model('Pod')
20const Video = mongoose.model('Video')
21 19
22router.get('/', listPods) 20router.get('/', listPods)
23router.post('/', 21router.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)