2016-11-04 09:03:13 +01:00
|
|
|
'use strict';
|
2016-11-04 09:35:53 +01:00
|
|
|
|
2016-11-05 14:08:47 +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');
|
2020-08-06 11:18:52 +02:00
|
|
|
const FeatureTypeStore = require('./feature-type-store');
|
2016-11-05 10:16:48 +01:00
|
|
|
const StrategyStore = require('./strategy-store');
|
2016-11-05 14:08:47 +01:00
|
|
|
const ClientInstanceStore = require('./client-instance-store');
|
2016-11-28 17:11:11 +01:00
|
|
|
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');
|
2020-02-27 21:26:18 +01:00
|
|
|
const ContextFieldStore = require('./context-field-store');
|
2020-04-13 22:38:46 +02:00
|
|
|
const SettingStore = require('./setting-store');
|
2020-05-12 23:05:26 +02:00
|
|
|
const UserStore = require('./user-store');
|
2020-09-28 21:54:44 +02:00
|
|
|
const ProjectStore = require('./project-store');
|
2021-01-18 12:32:19 +01:00
|
|
|
const TagStore = require('./tag-store');
|
2021-01-04 10:29:33 +01:00
|
|
|
const TagTypeStore = require('./tag-type-store');
|
2016-11-04 09:03:13 +01:00
|
|
|
|
2019-10-02 23:14:53 +02:00
|
|
|
module.exports.createStores = (config, eventBus) => {
|
2020-04-14 22:29:11 +02:00
|
|
|
const { getLogger } = config;
|
2019-10-02 23:14:53 +02:00
|
|
|
const db = createDb(config);
|
2019-04-30 21:14:23 +02:00
|
|
|
const eventStore = new EventStore(db, getLogger);
|
|
|
|
const clientMetricsDb = new ClientMetricsDb(db, getLogger);
|
2016-11-05 10:16:48 +01:00
|
|
|
|
|
|
|
return {
|
2016-11-05 14:08:47 +01:00
|
|
|
db,
|
2016-11-05 10:16:48 +01:00
|
|
|
eventStore,
|
2021-01-18 12:32:19 +01:00
|
|
|
featureToggleStore: new FeatureToggleStore(db, eventBus, getLogger),
|
2020-08-06 11:18:52 +02:00
|
|
|
featureTypeStore: new FeatureTypeStore(db, getLogger),
|
2021-01-18 12:32:19 +01:00
|
|
|
strategyStore: new StrategyStore(db, getLogger),
|
2019-08-04 11:10:51 +02:00
|
|
|
clientApplicationsStore: new ClientApplicationsStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
2020-04-14 22:29:11 +02:00
|
|
|
getLogger,
|
2019-08-04 11:10:51 +02:00
|
|
|
),
|
|
|
|
clientInstanceStore: new ClientInstanceStore(db, eventBus, getLogger),
|
|
|
|
clientMetricsStore: new ClientMetricsStore(
|
|
|
|
clientMetricsDb,
|
|
|
|
eventBus,
|
2020-04-14 22:29:11 +02:00
|
|
|
getLogger,
|
2019-08-04 11:10:51 +02:00
|
|
|
),
|
2020-02-27 21:26:18 +01:00
|
|
|
contextFieldStore: new ContextFieldStore(
|
|
|
|
db,
|
|
|
|
config.customContextFields,
|
|
|
|
eventStore,
|
2020-04-14 22:29:11 +02:00
|
|
|
getLogger,
|
2020-02-27 21:26:18 +01:00
|
|
|
),
|
2020-04-13 22:38:46 +02:00
|
|
|
settingStore: new SettingStore(db, getLogger),
|
2020-05-12 23:05:26 +02:00
|
|
|
userStore: new UserStore(db, getLogger),
|
2020-09-28 21:54:44 +02:00
|
|
|
projectStore: new ProjectStore(db, getLogger),
|
2021-01-18 12:32:19 +01:00
|
|
|
tagStore: new TagStore(db, eventBus, getLogger),
|
|
|
|
tagTypeStore: new TagTypeStore(db, eventBus, getLogger),
|
2016-11-05 10:16:48 +01:00
|
|
|
};
|
|
|
|
};
|