aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/v1/pods.js20
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()
17const Pod = mongoose.model('Pod') 17const Pod = mongoose.model('Pod')
18const Video = mongoose.model('Video') 18const Video = mongoose.model('Video')
19 19
20router.get('/', listPodsUrl) 20router.get('/', listPods)
21router.post('/', validators.podsAdd, addPods) 21router.post('/', validators.podsAdd, addPods)
22router.post('/makefriends', 22router.post('/makefriends',
23 oAuth.authenticate, 23 oAuth.authenticate,
@@ -74,11 +74,11 @@ function addPods (req, res, next) {
74 }) 74 })
75} 75}
76 76
77function listPodsUrl (req, res, next) { 77function 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
148function getFormatedPods (pods) {
149 const formatedPods = []
150
151 pods.forEach(function (pod) {
152 formatedPods.push(pod.toFormatedJSON())
153 })
154
155 return formatedPods
156}