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:
parent
78434a7ca1
commit
1777b5a510
@ -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 {
|
||||||
|
@ -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
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user