1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Fix event api

This commit is contained in:
Gard Rimestad 2014-11-14 07:28:40 +01:00 committed by Ivar Conradi Østhus
parent 78434a7ca1
commit 1777b5a510
2 changed files with 4 additions and 3 deletions

View File

@ -9,7 +9,7 @@ module.exports = function (app) {
}); });
app.get('/events/:name', function (req, res) { app.get('/events/:name', function (req, res) {
eventDb.getEvents(req.params.name).then(function (events) { eventDb.getEventsFilterByName(req.params.name).then(function (events) {
if (events) { if (events) {
res.json(events); res.json(events);
} else { } else {

View File

@ -23,7 +23,7 @@ function getEvents() {
}); });
} }
function getEvents(name) { function getEventsFilterByName(name) {
var sql = 'SELECT id, type, created_by as created, data ' + var sql = 'SELECT id, type, created_by as created, data ' +
'FROM events WHERE data ->> \'name\' = $1 ' + 'FROM events WHERE data ->> \'name\' = $1 ' +
'ORDER BY created_at DESC'; 'ORDER BY created_at DESC';
@ -46,5 +46,6 @@ function mapToEvent(row) {
module.exports = { module.exports = {
store: storeEvent, store: storeEvent,
getEvents: getEvents getEvents: getEvents,
getEventsFilterByName: getEventsFilterByName
}; };