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