Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/achievements/achievements.seed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AchievementType, AchievementDifficulty } from './entities/achievement.entity';
import { Logger } from '@nestjs/common';

/**
* Seed data for default achievements
Expand Down
5 changes: 5 additions & 0 deletions src/email-marketing/automation/automation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ export class AutomationService {
tag: action.config.tag,
});
break;
}
}
}g.tag,
});
break;
case ActionType.ADD_TO_SEGMENT:
this.eventEmitter.emit(APP_EVENTS.SEGMENT_ADD_USER, {
userId: payload.userId,
Expand Down
5 changes: 5 additions & 0 deletions src/email-marketing/entities/ab-test.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
OneToMany,
JoinColumn,
VersionColumn,
Index,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Campaign } from './campaign.entity';
Expand All @@ -30,6 +31,7 @@ export class ABTest {
name: string;

@ApiProperty()
@Index('IDX_ab_tests_campaignId')
@Column()
campaignId: string;

Expand All @@ -50,13 +52,15 @@ export class ABTest {
sampleSize: number; // Percentage of total recipients for test

@ApiProperty({ enum: ABTestStatus })
@Index('IDX_ab_tests_status')
@Column({ type: 'enum', enum: ABTestStatus, default: ABTestStatus.DRAFT })
status: ABTestStatus;

@OneToMany(() => ABTestVariant, (variant) => variant.abTest, { cascade: true })
variants: ABTestVariant[];

@ApiProperty({ required: false })
@Index('IDX_ab_tests_winnerId')
@Column({ nullable: true })
winnerId?: string;

Expand All @@ -69,6 +73,7 @@ export class ABTest {
endedAt?: Date;

@ApiProperty()
@Index('IDX_ab_tests_createdAt')
@CreateDateColumn()
createdAt: Date;
}
4 changes: 4 additions & 0 deletions src/migrations/1599999999999-BaselineSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2107,6 +2107,10 @@ export class BaselineSchema1599999999999 implements MigrationInterface {
`);
await queryRunner.query(`CREATE INDEX idx_notifications_dedup ON public.notifications USING btree ("userId", type, content_hash, "createdAt")
`);
await queryRunner.query(`CREATE INDEX idx_ab_tests_status ON public.ab_tests USING btree (status)
`);
await queryRunner.query(`CREATE INDEX idx_ab_test_variants_ab_test_id ON public.ab_test_variants USING btree ("abTestId")
`);
await queryRunner.query(`ALTER TABLE ONLY public.invoices
ADD CONSTRAINT "FK_02781c49b25ceb502571f0315f6" FOREIGN KEY (payment_id) REFERENCES public.payments(id)
`);
Expand Down
27 changes: 27 additions & 0 deletions src/migrations/1756476695000-add-ab-test-indexes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddAbTestIndexes1756476695000 implements MigrationInterface {
name = 'AddAbTestIndexes1756476695000';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
'CREATE INDEX IF NOT EXISTS "IDX_ab_tests_campaignId" ON "ab_tests" ("campaignId")',
);
await queryRunner.query(
'CREATE INDEX IF NOT EXISTS "IDX_ab_tests_status" ON "ab_tests" ("status")',
);
await queryRunner.query(
'CREATE INDEX IF NOT EXISTS "IDX_ab_tests_winnerId" ON "ab_tests" ("winnerId")',
);
await queryRunner.query(
'CREATE INDEX IF NOT EXISTS "IDX_ab_tests_createdAt" ON "ab_tests" ("createdAt")',
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('DROP INDEX IF EXISTS "IDX_ab_tests_createdAt"');
await queryRunner.query('DROP INDEX IF EXISTS "IDX_ab_tests_winnerId"');
await queryRunner.query('DROP INDEX IF EXISTS "IDX_ab_tests_status"');
await queryRunner.query('DROP INDEX IF EXISTS "IDX_ab_tests_campaignId"');
}
}
8 changes: 4 additions & 4 deletions src/payments/providers/payment-provider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class PaymentProviderService {
async chargeCustomer(
userId: string,
amount: number,
currency: string,
metadata: Record<string, unknown> = {},
_currency: string,
_metadata: Record<string, unknown> = {},
): Promise<ChargeResult> {
// TODO: replace with real Stripe call:
// const intent = await stripe.paymentIntents.create({ amount: Math.round(amount * 100), currency, ... });
Expand All @@ -57,8 +57,8 @@ export class PaymentProviderService {
async issueCredit(
userId: string,
amount: number,
currency: string,
metadata: Record<string, unknown> = {},
_currency: string,
_metadata: Record<string, unknown> = {},
): Promise<CreditResult> {
// TODO: replace with real Stripe call:
// const credit = await stripe.customers.createBalanceTransaction(customerId, { amount: -Math.round(amount * 100), currency });
Expand Down