pg-challenges
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -170,2 +170,13 @@ 'use strict'; | ||
} | ||
}, { | ||
method: 'GET', | ||
path: '/challengesSearch', | ||
handler: function (request, reply) { | ||
var searchTerm = request.query.searchTerm; | ||
request.server.methods.pg.challenges.challengesSearch(searchTerm, function (error, response) { // eslint-disable-line | ||
Hoek.assert(!error, 'challengesSearch failed'); | ||
reply(response); | ||
}); | ||
} | ||
} | ||
@@ -172,0 +183,0 @@ ]); |
@@ -101,3 +101,9 @@ 'use strict'; | ||
var challengesSearch = function (searchTerm, cb) { | ||
query(queries.challengesSearch(searchTerm), pool, function (queryErr, res) { | ||
return cb(queryErr, res.rows); | ||
}); | ||
}; | ||
query(initQuery, pool, function (initErr) { | ||
@@ -116,2 +122,3 @@ if (initErr) { | ||
server.method('pg.challenges.getArchived', getArchived); | ||
server.method('pg.challenges.challengesSearch', challengesSearch); | ||
@@ -118,0 +125,0 @@ return next(); |
@@ -12,2 +12,3 @@ 'use strict'; | ||
var getArchived = require('./getArchived.js'); | ||
var challengesSearch = require('./search.js'); | ||
@@ -23,3 +24,4 @@ module.exports = { | ||
getMatchingOrgs: getMatchingOrgs, | ||
getArchived: getArchived | ||
getArchived: getArchived, | ||
challengesSearch: challengesSearch | ||
}; |
{ | ||
"name": "pg-challenges", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Reusable challenges-system build with Postgres and Hapi.", | ||
@@ -27,5 +27,5 @@ "main": "lib/index.js", | ||
"boom": "^4.2.0", | ||
"ce100-mock-data": "^1.0.6", | ||
"ce100-mock-data": "^1.1.2", | ||
"env2": "^2.1.1", | ||
"hapi": "^16.6.0", | ||
"hapi": "^15.2.0", | ||
"hoek": "^4.1.0", | ||
@@ -41,3 +41,3 @@ "istanbul": "^0.4.5", | ||
"nodemon": "^1.11.0", | ||
"pg-people": "0.0.31", | ||
"pg-people": "0.1.6", | ||
"pre-commit": "^1.1.3", | ||
@@ -44,0 +44,0 @@ "tags-system": "^1.0.7", |
60580
48
1679
+ Addedcall@3.0.4(transitive)
+ Addedhapi@15.2.0(transitive)
+ Addedisemail@2.2.1(transitive)
+ Addedjoi@9.2.0(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addedsubtext@4.4.1(transitive)
- Removedcall@4.1.2(transitive)
- Removedhapi@16.8.4(transitive)
- Removedsomever@1.1.1(transitive)
- Removedsubtext@5.1.3(transitive)
Updatedce100-mock-data@^1.1.2
Updatedhapi@^15.2.0