From 80a6c9e76fda57f01e37fe4620771ae70738a211 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 21 Oct 2016 11:20:45 +0200 Subject: Server: pod removing refractoring --- server/controllers/api/v1/pods.js | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'server/controllers') 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 @@ 'use strict' -const each = require('async/each') const express = require('express') const mongoose = require('mongoose') const waterfall = require('async/waterfall') @@ -17,7 +16,6 @@ const signatureValidator = middlewares.validators.remote.signature const router = express.Router() const Pod = mongoose.model('Pod') -const Video = mongoose.model('Video') router.get('/', listPods) router.post('/', @@ -117,27 +115,7 @@ function removePods (req, res, next) { }, function removePod (pod, callback) { - pod.remove(function (err) { - // Be sure we only return one argument in the callback - return callback(err) - }) - }, - - function (callback) { - Video.listByUrls([ url ], function (err, videosList) { - if (err) { - logger.error('Cannot list videos from url.', { error: err }) - return callback(err) - } - - return callback(null, videosList) - }) - }, - - function removeTheRemoteVideos (videosList, callback) { - each(videosList, function (video, callbackEach) { - video.remove(callbackEach) - }, callback) + pod.remove(callback) } ], function (err) { if (err) return next(err) -- cgit v1.2.3