From c2ef404e980a0b46474fa4b7d7d100fbf248fe36 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 4 Nov 2016 09:23:46 +0100 Subject: [PATCH] Minor cleanup: eventDb inside db --- packages/unleash-api/lib/db/index.js | 2 ++ packages/unleash-api/server-impl.js | 5 +++-- packages/unleash-api/test/e2e/test-helper.js | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/unleash-api/lib/db/index.js b/packages/unleash-api/lib/db/index.js index be1f5d4b1d..7567b712f7 100644 --- a/packages/unleash-api/lib/db/index.js +++ b/packages/unleash-api/lib/db/index.js @@ -1,9 +1,11 @@ 'use strict'; +const eventDbCreator = require('./event'); const clientInstancesDbCreator = require('./client-instances'); const clientMetricsDbCreator = require('./client-metrics'); const clientStrategiesDbCreator = require('./client-strategies'); module.exports = (db) => ({ + eventDb: eventDbCreator(db), clientInstancesDb: clientInstancesDbCreator(db), clientMetricsDb: clientMetricsDbCreator(db), clientStrategiesDb: clientStrategiesDbCreator(db), diff --git a/packages/unleash-api/server-impl.js b/packages/unleash-api/server-impl.js index 26cc7740cd..3be983f29f 100644 --- a/packages/unleash-api/server-impl.js +++ b/packages/unleash-api/server-impl.js @@ -13,12 +13,13 @@ function createApp (options) { const db = require('./lib/db/db-pool')(options.databaseUri); // Database dependecies (statefull) - const eventDb = require('./lib/db/event')(db); + const { eventDb, clientInstancesDb, clientMetricsDb, clientStrategiesDb } = require('./lib/db')(db); + + // Needs some cleanup! const EventStore = require('./lib/event-store'); const eventStore = new EventStore(eventDb); const featureDb = require('./lib/db/feature')(db, eventStore); const strategyDb = require('./lib/db/strategy')(db, eventStore); - const { clientInstancesDb, clientMetricsDb, clientStrategiesDb } = require('./lib/db')(db); const config = { baseUriPath: options.baseUriPath, diff --git a/packages/unleash-api/test/e2e/test-helper.js b/packages/unleash-api/test/e2e/test-helper.js index 92f77c145f..e60a8c6aea 100644 --- a/packages/unleash-api/test/e2e/test-helper.js +++ b/packages/unleash-api/test/e2e/test-helper.js @@ -6,12 +6,11 @@ const BPromise = require('bluebird'); let request = require('supertest'); const databaseUri = require('./database-config').getDatabaseUri(); const knex = require('../../lib/db/db-pool')(databaseUri); -const eventDb = require('../../lib/db/event')(knex); +const { eventDb, clientInstancesDb, clientStrategiesDb, clientMetricsDb } = require('../../lib/db')(knex); const EventStore = require('../../lib/event-store'); const eventStore = new EventStore(eventDb); const featureDb = require('../../lib/db/feature')(knex, eventStore); const strategyDb = require('../../lib/db/strategy')(knex, eventStore); -const { clientInstancesDb, clientStrategiesDb, clientMetricsDb } = require('../../lib/db')(knex); const app = require('../../app')({