const Pod = mongoose.model('Pod')
const Video = mongoose.model('Video')
-router.get('/', listPodsUrl)
+router.get('/', listPods)
router.post('/', validators.podsAdd, addPods)
router.post('/makefriends',
oAuth.authenticate,
})
}
-function listPodsUrl (req, res, next) {
- Pod.listOnlyUrls(function (err, podsUrlList) {
+function listPods (req, res, next) {
+ Pod.list(function (err, podsUrlList) {
if (err) return next(err)
- res.json(podsUrlList)
+ res.json(getFormatedPods(podsUrlList))
})
}
res.type('json').status(204).end()
})
}
+
+// ---------------------------------------------------------------------------
+
+function getFormatedPods (pods) {
+ const formatedPods = []
+
+ pods.forEach(function (pod) {
+ formatedPods.push(pod.toFormatedJSON())
+ })
+
+ return formatedPods
+}