aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-16 21:37:17 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-16 21:37:17 +0100
commit5101105ef91bfe478f97546b78b321882da2079c (patch)
treea3deec88917fecb8f4299c710bab9ba7679b4803 /server/models
parent86e054b20fabb5934e09d0bcb096840dd28d69fd (diff)
downloadPeerTube-5101105ef91bfe478f97546b78b321882da2079c.tar.gz
PeerTube-5101105ef91bfe478f97546b78b321882da2079c.tar.zst
PeerTube-5101105ef91bfe478f97546b78b321882da2079c.zip
Video lib/model/reqvalidator refractoring
Diffstat (limited to 'server/models')
-rw-r--r--server/models/videos.js34
1 files changed, 0 insertions, 34 deletions
diff --git a/server/models/videos.js b/server/models/videos.js
index 436c08bfd..fd02ec9e1 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -31,8 +31,6 @@ var Videos = {
31 add: add, 31 add: add,
32 addRemotes: addRemotes, 32 addRemotes: addRemotes,
33 get: get, 33 get: get,
34 getVideoState: getVideoState,
35 isOwned: isOwned,
36 list: list, 34 list: list,
37 listOwned: listOwned, 35 listOwned: listOwned,
38 removeOwned: removeOwned, 36 removeOwned: removeOwned,
@@ -102,38 +100,6 @@ function get (id, callback) {
102 }) 100 })
103} 101}
104 102
105function getVideoState (id, callback) {
106 get(id, function (err, video) {
107 if (err) return callback(err)
108
109 var exist = (video !== null)
110 var owned = false
111 if (exist === true) {
112 owned = (video.namePath !== null)
113 }
114
115 return callback(null, { exist: exist, owned: owned })
116 })
117}
118
119function isOwned (id, callback) {
120 VideosDB.findById(id, function (err, video) {
121 if (err || !video) {
122 if (!err) err = new Error('Cannot find this video.')
123 logger.error('Cannot find this video.')
124 return callback(err)
125 }
126
127 if (video.namePath === null) {
128 var error_string = 'Cannot remove the video of another pod.'
129 logger.error(error_string)
130 return callback(new Error(error_string), false, video)
131 }
132
133 callback(null, true, video)
134 })
135}
136
137function list (callback) { 103function list (callback) {
138 VideosDB.find(function (err, videos_list) { 104 VideosDB.find(function (err, videos_list) {
139 if (err) { 105 if (err) {