fix(api): resolve NestJS DI + ValidationPipe bugs from type-only imports

- Remove `type` modifier from imports used as DI constructor params
  across ~235 files (@Injectable, @Controller, @Module, @Catch,
  @CommandHandler, @QueryHandler, @EventsHandler, @WebSocketGateway).
  TypeScript emitDecoratorMetadata strips type-only imports, leaving
  Reflect.metadata with Function placeholder and breaking Nest DI.
- Fix controllers: DTOs used with @Body/@Query/@Param must be runtime
  imports so ValidationPipe can whitelist properties. Previously
  returned 400 "property X should not exist" on every request.
- Register ProjectsModule in AppModule (was defined but never wired).
- Add approve()/reject() methods to TransferListingEntity referenced by
  ModerateTransferListingHandler.
- Export BankTransferConfirmedEvent from payments barrel for
  subscription activation handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-18 21:50:30 +07:00
parent 4143c4dcb9
commit 312532b1cb
242 changed files with 460 additions and 442 deletions

View File

@@ -2,7 +2,7 @@ import { InjectQueue } from '@nestjs/bullmq';
import { Inject } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { createId } from '@paralleldrive/cuid2';
import { type Queue } from 'bullmq';
import { Queue } from 'bullmq';
import { ReportEntity } from '../../../domain/entities/report.entity';
import { REPORT_REPOSITORY, type IReportRepository } from '../../../domain/repositories/report.repository';
import { GenerateReportCommand } from './generate-report.command';

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { type Prisma, type Report as PrismaReport } from '@prisma/client';
import { type PrismaService } from '@modules/shared';
import { PrismaService } from '@modules/shared';
import { ReportEntity } from '../../domain/entities/report.entity';
import { type ReportStatus } from '../../domain/enums/report-status.enum';
import { type ReportType } from '../../domain/enums/report-type.enum';

View File

@@ -1,6 +1,6 @@
import Anthropic from '@anthropic-ai/sdk';
import { Injectable, Logger } from '@nestjs/common';
import { type ConfigService } from '@nestjs/config';
import { ConfigService } from '@nestjs/config';
import {
type IAINarrativeService,
type NarrativeRequest,

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { type PrismaService } from '@modules/shared';
import { PrismaService } from '@modules/shared';
import { type IInfrastructureDataService, type InfrastructureProjectData } from '../../domain/services/infrastructure-data.service';
@Injectable()

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { type PrismaService } from '@modules/shared';
import { PrismaService } from '@modules/shared';
import { type IMacroDataService, type MacroDataPoint } from '../../domain/services/macro-data.service';
@Injectable()

View File

@@ -12,7 +12,7 @@ import {
Req,
UseGuards,
} from '@nestjs/common';
import { type CommandBus, type QueryBus } from '@nestjs/cqrs';
import { CommandBus, QueryBus } from '@nestjs/cqrs';
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiQuery } from '@nestjs/swagger';
import { JwtAuthGuard } from '@modules/auth';
import { RequireQuota, QuotaGuard } from '@modules/subscriptions';
@@ -24,8 +24,8 @@ import { type ListReportsResult } from '../../application/queries/list-reports/l
import { ListReportsQuery } from '../../application/queries/list-reports/list-reports.query';
import { type ReportEntity } from '../../domain/entities/report.entity';
import { MACRO_DATA_SERVICE, type IMacroDataService } from '../../domain/services/macro-data.service';
import { type GenerateReportDto } from '../dto/generate-report.dto';
import { type ListReportsDto } from '../dto/list-reports.dto';
import { GenerateReportDto } from '../dto/generate-report.dto';
import { ListReportsDto } from '../dto/list-reports.dto';
interface AuthenticatedRequest {
user: { sub: string };