Skip to content

Commit

Permalink
Feat/enterprise stores (#2289)
Browse files Browse the repository at this point in the history
* feat: add capabilities for stores in enterprise

* fix: remove unused files
  • Loading branch information
FredrikOseberg committed Oct 31, 2022
1 parent ce6d2e5 commit 3029564
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 444 deletions.
6 changes: 4 additions & 2 deletions src/lib/app.ts
Expand Up @@ -24,12 +24,14 @@ import { loadIndexHTML } from './util/load-index-html';
import { findPublicFolder } from './util/findPublicFolder';
import { conditionalMiddleware } from './middleware/conditional-middleware';
import patMiddleware from './middleware/pat-middleware';
import { Knex } from 'knex';

export default async function getApp(
config: IUnleashConfig,
stores: IUnleashStores,
services: IUnleashServices,
unleashSession?: RequestHandler,
db?: Knex,
): Promise<Application> {
const app = express();

Expand All @@ -48,7 +50,7 @@ export default async function getApp(
app.use(requestLogger(config));

if (typeof config.preHook === 'function') {
config.preHook(app, config, services);
config.preHook(app, config, services, db);
}

app.use(compression());
Expand Down Expand Up @@ -137,7 +139,7 @@ export default async function getApp(
);

if (typeof config.preRouterHook === 'function') {
config.preRouterHook(app, config, services, stores);
config.preRouterHook(app, config, services, stores, db);
}

// Setup API routes
Expand Down
2 changes: 0 additions & 2 deletions src/lib/db/index.ts
Expand Up @@ -32,7 +32,6 @@ import SegmentStore from './segment-store';
import GroupStore from './group-store';
import PatStore from './pat-store';
import { PublicSignupTokenStore } from './public-signup-token-store';
import { SuggestChangeStore } from './suggest-change-store';

export const createStores = (
config: IUnleashConfig,
Expand Down Expand Up @@ -93,7 +92,6 @@ export const createStores = (
getLogger,
),
patStore: new PatStore(db, getLogger),
suggestChangeStore: new SuggestChangeStore(db, eventBus, getLogger),
};
};

Expand Down
277 changes: 0 additions & 277 deletions src/lib/db/suggest-change-store.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/server-impl.ts
Expand Up @@ -57,7 +57,7 @@ async function createApp(
// eslint-disable-next-line no-param-reassign
config.server.secret = secret;
}
const app = await getApp(config, stores, services, unleashSession);
const app = await getApp(config, stores, services, unleashSession, db);

if (typeof config.eventHook === 'function') {
addEventHook(config.eventHook, stores.eventStore);
Expand Down
2 changes: 0 additions & 2 deletions src/lib/types/stores.ts
Expand Up @@ -28,7 +28,6 @@ import { ISegmentStore } from './stores/segment-store';
import { IGroupStore } from './stores/group-store';
import { IPatStore } from './stores/pat-store';
import { IPublicSignupTokenStore } from './stores/public-signup-token-store';
import { ISuggestChangeStore } from './stores/suggest-change-store';

export interface IUnleashStores {
accessStore: IAccessStore;
Expand Down Expand Up @@ -61,5 +60,4 @@ export interface IUnleashStores {
segmentStore: ISegmentStore;
patStore: IPatStore;
publicSignupTokenStore: IPublicSignupTokenStore;
suggestChangeStore: ISuggestChangeStore;
}
44 changes: 0 additions & 44 deletions src/lib/types/stores/suggest-change-store.ts

This file was deleted.

0 comments on commit 3029564

Please sign in to comment.