mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
30 lines
642 B
JavaScript
30 lines
642 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const COLUMNS = ['id', 'name', 'description', 'lifetime_days'];
|
||
|
const TABLE = 'feature_types';
|
||
|
|
||
|
class FeatureToggleStore {
|
||
|
constructor(db, getLogger) {
|
||
|
this.db = db;
|
||
|
this.getLogger = getLogger('feature-type-store.js');
|
||
|
}
|
||
|
|
||
|
getAll() {
|
||
|
return this.db
|
||
|
.select(COLUMNS)
|
||
|
.from(TABLE)
|
||
|
.map(this.rowToFeatureType);
|
||
|
}
|
||
|
|
||
|
rowToFeatureType(row) {
|
||
|
return {
|
||
|
id: row.id,
|
||
|
name: row.name,
|
||
|
description: row.description,
|
||
|
lifetimeDays: row.lifetime_days,
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = FeatureToggleStore;
|