Skip to content

Commit

Permalink
fix: comments from PR, use whereIn instead of boolean field
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswk committed Nov 28, 2024
1 parent 04f0c9f commit dd43c67
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
6 changes: 5 additions & 1 deletion src/lib/db/feature-environment-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export class FeatureEnvironmentStore implements IFeatureEnvironmentStore {
'=',
`${T.featureEnvs}.environment`,
)
.where('environments.enabled_in_oss', true);
.whereIn('environments.name', [
'default',
'development',
'production',
]);
}
return queryBuilder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class ClientFeatureToggleService {
this.logger = getLogger('services/client-feature-toggle-service.ts');
this.segmentReadModel = segmentReadModel;
this.clientFeatureToggleStore = clientFeatureToggleStore;
const isTest = process.env.NODE_ENV === 'test';
}

async getActiveSegmentsForClient() {
Expand Down
16 changes: 12 additions & 4 deletions src/lib/features/project-environments/environment-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ export default class EnvironmentStore implements IEnvironmentStore {
const stopTimer = this.timer('get');
let keyQuery = this.db<IEnvironmentsTable>(TABLE).where({ name: key });
if (this.isOss) {
keyQuery = keyQuery.where('enabled_in_oss', true);
keyQuery = keyQuery.whereIn('name', [
'default',
'development',
'production',
]);
}
const row = await keyQuery.first();
stopTimer();
Expand All @@ -180,7 +184,7 @@ export default class EnvironmentStore implements IEnvironmentStore {
qB = qB.where(query);
}
if (this.isOss) {
qB = qB.where('enabled_in_oss', true);
qB = qB.whereIn('name', ['default', 'development', 'production']);
}
const rows = await qB;
stopTimer();
Expand Down Expand Up @@ -210,7 +214,7 @@ export default class EnvironmentStore implements IEnvironmentStore {
qB = qB.where(query);
}
if (this.isOss) {
qB = qB.where('enabled_in_oss', true);
qB = qB.whereIn('name', ['default', 'development', 'production']);
}
const rows = await qB;
stopTimer();
Expand Down Expand Up @@ -247,7 +251,11 @@ export default class EnvironmentStore implements IEnvironmentStore {
qB = qB.where(query);
}
if (this.isOss) {
qB = qB.where('environments.enabled_in_oss', true);
qB = qB.whereIn('environments.name', [
'default',
'production',
'development',
]);
}

const rows = await qB;
Expand Down

This file was deleted.

0 comments on commit dd43c67

Please sign in to comment.