mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Use knex' map()
This commit is contained in:
parent
3d52d97f85
commit
d591cdad2b
@ -14,9 +14,7 @@ function getEvents() {
|
||||
.select(EVENT_COLUMNS)
|
||||
.from('events')
|
||||
.orderBy('created_at', 'desc')
|
||||
.then(function (rows) {
|
||||
return rows.map(rowToEvent);
|
||||
});
|
||||
.map(rowToEvent);
|
||||
}
|
||||
|
||||
function getEventsFilterByName(name) {
|
||||
@ -25,9 +23,7 @@ function getEventsFilterByName(name) {
|
||||
.from('events')
|
||||
.whereRaw("data ->> 'name' = ?", [name])
|
||||
.orderBy('created_at', 'desc')
|
||||
.then(function (rows) {
|
||||
return rows.map(rowToEvent);
|
||||
});
|
||||
.map(rowToEvent);
|
||||
}
|
||||
|
||||
function rowToEvent(row) {
|
||||
|
@ -26,9 +26,7 @@ function getFeatures() {
|
||||
.select(FEATURE_COLUMNS)
|
||||
.from('features')
|
||||
.orderBy('created_at', 'desc')
|
||||
.then(function (rows) {
|
||||
return rows.map(rowToFeature);
|
||||
});
|
||||
.map(rowToFeature);
|
||||
}
|
||||
|
||||
function getFeature(name) {
|
||||
|
Loading…
Reference in New Issue
Block a user