+ res.json(getFormatedUsers(usersList))
+ })
+}
+
+function removeUser (req, res, next) {
+ waterfall([
+ function getUser (callback) {
+ User.loadById(req.params.id, callback)
+ },
+
+ function getVideos (user, callback) {
+ Video.listOwnedByAuthor(user.username, function (err, videos) {
+ return callback(err, user, videos)
+ })
+ },
+
+ function removeVideosFromDB (user, videos, callback) {
+ each(videos, function (video, callbackEach) {
+ video.remove(callbackEach)
+ }, function (err) {
+ return callback(err, user, videos)
+ })
+ },
+
+ function sendInformationToFriends (user, videos, callback) {
+ videos.forEach(function (video) {
+ const params = {
+ name: video.name,
+ magnetUri: video.magnetUri
+ }