Skip to content

Commit

Permalink
Remove FF_TARGETED_MESSAGING (#2122)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgomezv authored Nov 13, 2024
1 parent 5241a20 commit de7f488
Show file tree
Hide file tree
Showing 56 changed files with 216 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
#FF_TWAPS_DECODING=

# Targeted Messaging
#FF_TARGETED_MESSAGING=
#TARGETED_MESSAGING_FILE_STORAGE_TYPE=

# Community
Expand All @@ -174,5 +173,4 @@
#STAKING_API_KEY=

# Targeted Messaging
#FF_TARGETED_MESSAGING=
#TARGETED_MESSAGING_FILE_STORAGE_TYPE=
4 changes: 4 additions & 0 deletions src/app.module.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Application bootstrap', () => {
it('should init the app', async () => {
Expand All @@ -20,6 +22,8 @@ describe('Application bootstrap', () => {
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();
Expand Down
3 changes: 1 addition & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class AppModule implements NestModule {
email: isEmailFeatureEnabled,
delegatesV2: isDelegatesV2Enabled,
pushNotifications: isPushNotificationsEnabled,
targetedMessaging: isTargetedMessagingFeatureEnabled,
} = configFactory()['features'];

return {
Expand Down Expand Up @@ -108,7 +107,7 @@ export class AppModule implements NestModule {
RootModule,
SafeAppsModule,
SafesModule,
...(isTargetedMessagingFeatureEnabled ? [TargetedMessagingModule] : []),
TargetedMessagingModule,
TransactionsModule,
TransactionsViewControllerModule,
// common
Expand Down
1 change: 0 additions & 1 deletion src/config/entities/__tests__/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export default (): ReturnType<typeof configuration> => ({
pushNotifications: false,
nativeStaking: false,
nativeStakingDecoding: false,
targetedMessaging: false,
improvedAddressPoisoning: false,
},
httpClient: { requestTimeout: faker.number.int() },
Expand Down
2 changes: 0 additions & 2 deletions src/config/entities/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ export default () => ({
nativeStaking: process.env.FF_NATIVE_STAKING?.toLowerCase() === 'true',
nativeStakingDecoding:
process.env.FF_NATIVE_STAKING_DECODING?.toLowerCase() === 'true',
targetedMessaging:
process.env.FF_TARGETED_MESSAGING?.toLowerCase() === 'true',
improvedAddressPoisoning:
process.env.FF_IMPROVED_ADDRESS_POISONING?.toLowerCase() === 'true',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ import { SubmissionNotFoundError } from '@/domain/targeted-messaging/errors/subm
import { TargetedSafeNotFoundError } from '@/domain/targeted-messaging/errors/targeted-safe-not-found.error';
import { ILoggingService, LoggingService } from '@/logging/logging.interface';
import { asError } from '@/logging/utils';
import { Inject, UnprocessableEntityException } from '@nestjs/common';
import {
Inject,
Injectable,
UnprocessableEntityException,
} from '@nestjs/common';
import postgres from 'postgres';

@Injectable()
export class TargetedMessagingDatasource
implements ITargetedMessagingDatasource
{
Expand Down
16 changes: 10 additions & 6 deletions src/routes/about/__tests__/get-about.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import '@/__tests__/matchers/to-be-string-or-null';
import { AppModule } from '@/app.module';
import { CacheKeyPrefix } from '@/datasources/cache/constants';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';
import { expect } from '@jest/globals';
import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import type { Server } from 'net';
import request from 'supertest';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';

describe('Get about e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -27,6 +29,8 @@ describe('Get about e2e test', () => {
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();
Expand Down
4 changes: 4 additions & 0 deletions src/routes/accounts/accounts.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { TestNetworkModule } from '@/datasources/network/__tests__/test.network.
import { NetworkModule } from '@/datasources/network/network.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';
import { accountDataSettingBuilder } from '@/domain/accounts/entities/__tests__/account-data-setting.builder';
import { accountDataTypeBuilder } from '@/domain/accounts/entities/__tests__/account-data-type.builder';
import { accountBuilder } from '@/domain/accounts/entities/__tests__/account.builder';
Expand Down Expand Up @@ -70,6 +72,8 @@ describe('AccountsController', () => {
.useModule(TestAccountsDataSourceModule)
.overrideModule(CounterfactualSafesDatasourceModule)
.useModule(TestCounterfactualSafesDataSourceModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { TestNetworkModule } from '@/datasources/network/__tests__/test.network.
import { NetworkModule } from '@/datasources/network/network.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';
import type { IAccountsRepository } from '@/domain/accounts/accounts.repository.interface';
import { counterfactualSafeBuilder } from '@/domain/accounts/counterfactual-safes/entities/__tests__/counterfactual-safe.builder';
import { createCounterfactualSafeDtoBuilder } from '@/domain/accounts/counterfactual-safes/entities/__tests__/create-counterfactual-safe.dto.entity.builder';
Expand Down Expand Up @@ -66,6 +68,8 @@ describe('CounterfactualSafesController', () => {
.useModule(TestAccountsDataSourceModule)
.overrideModule(CounterfactualSafesDatasourceModule)
.useModule(TestCounterfactualSafesDataSourceModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
6 changes: 6 additions & 0 deletions src/routes/alerts/alerts.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.post
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

// The `x-tenderly-signature` header contains a cryptographic signature. The webhook request signature is
// a HMAC SHA256 hash of concatenated signing secret, request payload, and timestamp, in this order.
Expand Down Expand Up @@ -103,6 +105,8 @@ describe('Alerts (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(ALERTS_CONFIGURATION_MODULE)
.useModule(AlertsConfigurationModule.register(alertsConfiguration))
.overrideModule(ALERTS_API_CONFIGURATION_MODULE)
Expand Down Expand Up @@ -897,6 +901,8 @@ describe('Alerts (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/auth/auth.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.post
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

const verifySiweMessageMock = jest.fn();

Expand All @@ -52,6 +54,8 @@ describe('AuthController', () => {
.useModule(TestPostgresDatabaseModule)
.overrideModule(BlockchainApiManagerModule)
.useModule(TestBlockchainApiManagerModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Balances Controller (Unit)', () => {
let app: INestApplication<Server>;
Expand Down Expand Up @@ -75,6 +77,8 @@ describe('Balances Controller (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/balances/balances.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import type { INetworkService } from '@/datasources/network/network.service.inte
import { NetworkService } from '@/datasources/network/network.service.interface';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';
import { balanceBuilder } from '@/domain/balances/entities/__tests__/balance.builder';
import { balanceTokenBuilder } from '@/domain/balances/entities/__tests__/balance.token.builder';
import { chainBuilder } from '@/domain/chains/entities/__tests__/chain.builder';
Expand Down Expand Up @@ -54,6 +56,8 @@ describe('Balances Controller (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/chains/chains.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Chains Controller (Unit)', () => {
let app: INestApplication<Server>;
Expand Down Expand Up @@ -64,6 +66,8 @@ describe('Chains Controller (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Zerion Collectibles Controller', () => {
let app: INestApplication<Server>;
Expand All @@ -47,6 +49,8 @@ describe('Zerion Collectibles Controller', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/collectibles/collectibles.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.post
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { PostgresDatabaseModuleV2 } from '@/datasources/db/v2/postgres-database.module';
import { TestPostgresDatabaseModuleV2 } from '@/datasources/db/v2/test.postgres-database.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Collectibles Controller (Unit)', () => {
let app: INestApplication<Server>;
Expand All @@ -59,6 +61,8 @@ describe('Collectibles Controller (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/community/community.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import { IdentityApiModule } from '@/datasources/locking-api/identity-api.module
import { TestIdentityApiModule } from '@/datasources/locking-api/__tests__/test.identity-api.module';
import { IIdentityApi } from '@/domain/interfaces/identity-api.interface';
import { eligibilityBuilder } from '@/domain/community/entities/__tests__/eligibility.builder';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Community (Unit)', () => {
let app: INestApplication<Server>;
Expand All @@ -65,6 +67,8 @@ describe('Community (Unit)', () => {
})
.overrideModule(PostgresDatabaseModule)
.useModule(TestPostgresDatabaseModule)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(CacheModule)
.useModule(TestCacheModule)
.overrideModule(RequestScopedLoggingModule)
Expand Down
4 changes: 4 additions & 0 deletions src/routes/contracts/__tests__/get-contract.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { TestPostgresDatabaseModule } from '@/datasources/db/__tests__/test.post
import { PostgresDatabaseModule } from '@/datasources/db/v1/postgres-database.module';
import { TestQueuesApiModule } from '@/datasources/queues/__tests__/test.queues-api.module';
import { QueuesApiModule } from '@/datasources/queues/queues-api.module';
import { TestTargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/__tests__/test.targeted-messaging.datasource.module';
import { TargetedMessagingDatasourceModule } from '@/datasources/targeted-messaging/targeted-messaging.datasource.module';

describe('Get contract e2e test', () => {
let app: INestApplication<Server>;
Expand All @@ -30,6 +32,8 @@ describe('Get contract e2e test', () => {
.useModule(TestPostgresDatabaseModule)
.overrideModule(PostgresDatabaseModuleV2)
.useModule(TestPostgresDatabaseModuleV2)
.overrideModule(TargetedMessagingDatasourceModule)
.useModule(TestTargetedMessagingDatasourceModule)
.overrideModule(QueuesApiModule)
.useModule(TestQueuesApiModule)
.compile();
Expand Down
Loading

0 comments on commit de7f488

Please sign in to comment.