1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/db/index.js

55 lines
2.1 KiB
JavaScript
Raw Normal View History

2016-11-04 09:03:13 +01:00
'use strict';
2016-11-04 09:35:53 +01:00
const { createDb } = require('./db-pool');
2016-11-05 10:16:48 +01:00
const EventStore = require('./event-store');
const FeatureToggleStore = require('./feature-toggle-store');
const FeatureTypeStore = require('./feature-type-store');
2016-11-05 10:16:48 +01:00
const StrategyStore = require('./strategy-store');
const ClientInstanceStore = require('./client-instance-store');
const ClientMetricsDb = require('./client-metrics-db');
2016-11-05 13:36:44 +01:00
const ClientMetricsStore = require('./client-metrics-store');
2016-12-06 09:19:15 +01:00
const ClientApplicationsStore = require('./client-applications-store');
const ContextFieldStore = require('./context-field-store');
const SettingStore = require('./setting-store');
2020-05-12 23:05:26 +02:00
const UserStore = require('./user-store');
const ProjectStore = require('./project-store');
const TagStore = require('./tag-store');
const TagTypeStore = require('./tag-type-store');
2016-11-04 09:03:13 +01:00
module.exports.createStores = (config, eventBus) => {
const { getLogger } = config;
const db = createDb(config);
const eventStore = new EventStore(db, getLogger);
const clientMetricsDb = new ClientMetricsDb(db, getLogger);
2016-11-05 10:16:48 +01:00
return {
db,
2016-11-05 10:16:48 +01:00
eventStore,
featureToggleStore: new FeatureToggleStore(db, eventBus, getLogger),
featureTypeStore: new FeatureTypeStore(db, getLogger),
strategyStore: new StrategyStore(db, getLogger),
clientApplicationsStore: new ClientApplicationsStore(
db,
eventBus,
getLogger,
),
clientInstanceStore: new ClientInstanceStore(db, eventBus, getLogger),
clientMetricsStore: new ClientMetricsStore(
clientMetricsDb,
eventBus,
getLogger,
),
contextFieldStore: new ContextFieldStore(
db,
config.customContextFields,
eventStore,
getLogger,
),
settingStore: new SettingStore(db, getLogger),
2020-05-12 23:05:26 +02:00
userStore: new UserStore(db, getLogger),
projectStore: new ProjectStore(db, getLogger),
tagStore: new TagStore(db, eventBus, getLogger),
tagTypeStore: new TagTypeStore(db, eventBus, getLogger),
2016-11-05 10:16:48 +01:00
};
};