From aab6cccbcfaace0114b583a3e77d97cf31ae232a Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 5 Jun 2013 12:42:48 -0400 Subject: [PATCH] Add docs to playlist.middleware --- models/playlist.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/playlist.js b/models/playlist.js index 4e00af8..d2a37b9 100644 --- a/models/playlist.js +++ b/models/playlist.js @@ -42,6 +42,13 @@ module.exports = { callback(err); }); }, + // middleware gets the user's playlist of badges and makes it available via + // `req.playlist`, which is a sorted array of badges. + // It expects that `req.remote.badges` exists and that it is the *full* list + // of all badges -- this list is then filtered down by what's in the + // playlist table to produce the user's playlist (nb: once/if the openbadger + // API supports taking a list of badge shortnames to return badge details + // about, retrieving the full list from the API is no longer necessary). middleware: function (req, res, next) { var badges = req.remote.badges; var user = res.locals.user;