Skip to content

Commit 8cdcc7b

Browse files
committed
fix: apply prettier formatting and fix no-case-declarations lint errors
1 parent 796e86b commit 8cdcc7b

5 files changed

Lines changed: 29 additions & 16 deletions

File tree

src/campaigns/campaigns.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,11 @@ function parseMilestoneTargetAmount(targetAmount?: string) {
452452
const raw = targetAmount?.trim();
453453
const amount = raw ? Number(raw) : Number.NaN;
454454

455-
if (!raw || !Number.isFinite(amount) || amount < MIN_MILESTONE_TARGET_AMOUNT) {
455+
if (
456+
!raw ||
457+
!Number.isFinite(amount) ||
458+
amount < MIN_MILESTONE_TARGET_AMOUNT
459+
) {
456460
throw new BadRequestException(
457461
`milestone targetAmount is required and must be at least ${MIN_MILESTONE_TARGET_AMOUNT}`,
458462
);

src/milestones/milestones.service.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,16 @@ describe('MilestonesService', () => {
191191
describe('getCampaignFundReleaseStats', () => {
192192
it('aggregates counts and sums grouped by status', async () => {
193193
prisma.fundRelease.groupBy.mockResolvedValueOnce([
194-
{ status: 'PENDING', _count: 2, _sum: { amount: { toString: () => '300' } } },
195-
{ status: 'RELEASED', _count: 1, _sum: { amount: { toString: () => '700' } } },
194+
{
195+
status: 'PENDING',
196+
_count: 2,
197+
_sum: { amount: { toString: () => '300' } },
198+
},
199+
{
200+
status: 'RELEASED',
201+
_count: 1,
202+
_sum: { amount: { toString: () => '700' } },
203+
},
196204
]);
197205

198206
const result = await service.getCampaignFundReleaseStats(CAMPAIGN_ID);

src/queue/contract-events.processor.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ export class ContractEventsProcessor {
5858
const { eventType, topics, value, contractId, txHash } = data;
5959

6060
switch (eventType) {
61-
case 'DonationReceived':
61+
case 'DonationReceived': {
6262
const donorAddress = topics[1] as string | undefined;
6363
if (!donorAddress) {
64-
this.logger.warn(`DonationReceived tx=${txHash}: no donor address in topics`);
64+
this.logger.warn(
65+
`DonationReceived tx=${txHash}: no donor address in topics`,
66+
);
6567
break;
6668
}
67-
const amount = typeof value === 'object' && value !== null && 'amount' in value
68-
? Number((value as Record<string, unknown>).amount)
69-
: undefined;
69+
const amount =
70+
typeof value === 'object' && value !== null && 'amount' in value
71+
? Number((value as Record<string, unknown>).amount)
72+
: undefined;
7073

7174
await this.prisma.donation.updateMany({
7275
where: { txHash, status: 'PENDING' },
@@ -77,6 +80,7 @@ export class ContractEventsProcessor {
7780
`Confirmed donation tx=${txHash} ${amount ? `amount=${amount} ` : ''}donor=${donorAddress}`,
7881
);
7982
break;
83+
}
8084

8185
case 'MilestoneReleased':
8286
await this.prisma.milestone.updateMany({

src/stellar/stellar-event.service.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('StellarEventService — cursor persistence', () => {
2525
if (key === 'STELLAR_NETWORK') return undefined;
2626
return fallback;
2727
}),
28-
} as any;
28+
};
2929
}
3030

3131
async function createService(): Promise<StellarEventService> {
@@ -94,10 +94,11 @@ describe('StellarEventService — cursor persistence', () => {
9494
mockConfig = {
9595
get: jest.fn((key: string) => {
9696
if (key === 'STELLAR_NETWORK') return 'custom-network';
97-
if (key === 'STELLAR_HORIZON_URL') return 'https://horizon-testnet.stellar.org';
97+
if (key === 'STELLAR_HORIZON_URL')
98+
return 'https://horizon-testnet.stellar.org';
9899
return undefined;
99100
}),
100-
} as any;
101+
};
101102
const svc = await createService();
102103
expect((svc as any).network).toBe('custom-network');
103104
});

src/stellar/stellar-event.service.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
Injectable,
3-
OnApplicationBootstrap,
4-
Logger,
5-
} from '@nestjs/common';
1+
import { Injectable, OnApplicationBootstrap, Logger } from '@nestjs/common';
62
import { ConfigService } from '@nestjs/config';
73
import type { Queue } from 'bull';
84
import { InjectQueue } from '@nestjs/bull';

0 commit comments

Comments
 (0)