2020-08-06 11:18:52 +02:00
|
|
|
'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');
|
|
|
|
}
|
|
|
|
|
2020-09-18 09:05:09 +02:00
|
|
|
async getAll() {
|
|
|
|
const rows = await this.db.select(COLUMNS).from(TABLE);
|
|
|
|
return rows.map(this.rowToFeatureType);
|
2020-08-06 11:18:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rowToFeatureType(row) {
|
|
|
|
return {
|
|
|
|
id: row.id,
|
|
|
|
name: row.name,
|
|
|
|
description: row.description,
|
|
|
|
lifetimeDays: row.lifetime_days,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = FeatureToggleStore;
|