diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-26 18:55:10 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-26 18:55:10 +0200 |
commit | 535724234aafd90c9eac17d9998f3f1c6c6c7615 (patch) | |
tree | 5b37a63037006abd60548877a00208fb97bb9fde /server/controllers/api | |
parent | cc599f34b7a55adbc614898fe8fd63ecc38f5e7d (diff) | |
download | PeerTube-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.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 | } | ||