diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/v1/pods.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index 360575a0d..2bdfe0c92 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js | |||
@@ -17,7 +17,7 @@ const router = express.Router() | |||
17 | const Pod = mongoose.model('Pod') | 17 | const Pod = mongoose.model('Pod') |
18 | const Video = mongoose.model('Video') | 18 | const Video = mongoose.model('Video') |
19 | 19 | ||
20 | router.get('/', listPodsUrl) | 20 | router.get('/', listPods) |
21 | router.post('/', validators.podsAdd, addPods) | 21 | router.post('/', validators.podsAdd, addPods) |
22 | router.post('/makefriends', | 22 | router.post('/makefriends', |
23 | oAuth.authenticate, | 23 | oAuth.authenticate, |
@@ -74,11 +74,11 @@ function addPods (req, res, next) { | |||
74 | }) | 74 | }) |
75 | } | 75 | } |
76 | 76 | ||
77 | function listPodsUrl (req, res, next) { | 77 | function listPods (req, res, next) { |
78 | Pod.listOnlyUrls(function (err, podsUrlList) { | 78 | Pod.list(function (err, podsUrlList) { |
79 | if (err) return next(err) | 79 | if (err) return next(err) |
80 | 80 | ||
81 | res.json(podsUrlList) | 81 | res.json(getFormatedPods(podsUrlList)) |
82 | }) | 82 | }) |
83 | } | 83 | } |
84 | 84 | ||
@@ -142,3 +142,15 @@ function quitFriends (req, res, next) { | |||
142 | res.type('json').status(204).end() | 142 | res.type('json').status(204).end() |
143 | }) | 143 | }) |
144 | } | 144 | } |
145 | |||
146 | // --------------------------------------------------------------------------- | ||
147 | |||
148 | function getFormatedPods (pods) { | ||
149 | const formatedPods = [] | ||
150 | |||
151 | pods.forEach(function (pod) { | ||
152 | formatedPods.push(pod.toFormatedJSON()) | ||
153 | }) | ||
154 | |||
155 | return formatedPods | ||
156 | } | ||