aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-26 18:55:10 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-26 18:55:10 +0200
commit535724234aafd90c9eac17d9998f3f1c6c6c7615 (patch)
tree5b37a63037006abd60548877a00208fb97bb9fde /server/controllers/api
parentcc599f34b7a55adbc614898fe8fd63ecc38f5e7d (diff)
downloadPeerTube-535724234aafd90c9eac17d9998f3f1c6c6c7615.tar.gz
PeerTube-535724234aafd90c9eac17d9998f3f1c6c6c7615.tar.zst
PeerTube-535724234aafd90c9eac17d9998f3f1c6c6c7615.zip
Server: add pod created date and score to the list controller
Diffstat (limited to 'server/controllers/api')
-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}