Skip to content

Commit

Permalink
starred by user view
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 30, 2012
1 parent 7e72c6e commit 97d90ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions registry/rewrites.js
Expand Up @@ -35,6 +35,7 @@ module.exports =
, method: "GET" }

, { from: "/-/by-user/:user", to: "_list/byUser/byUser", method: "GET" }
, { from: "/-/starred-by-user/:user", to: "_list/byUser/starredByUser", method: "GET" }

, { from: "/:pkg", to: "/_show/package/:pkg", method: "GET" }
, { from: "/:pkg/-/jsonp/:jsonp", to: "/_show/package/:pkg", method: "GET" }
Expand Down
8 changes: 8 additions & 0 deletions registry/views.js
Expand Up @@ -136,6 +136,14 @@ views.orphanAttachments = {
}
}

views.starredByUser = { map : function (doc) {
if (!doc || !doc.users) return
Object.keys(doc.users).forEach(function (m) {
if (!doc.users[m]) return
emit(m, doc._id)
})
}}

views.byUser = { map : function (doc) {
if (!doc || !doc.maintainers) return
doc.maintainers.forEach(function (m) {
Expand Down

0 comments on commit 97d90ab

Please sign in to comment.