fix(api,ci): remove type-only imports for DI and isolate CI ports from dev

- Remove `type` keyword from NestJS injectable class imports across all
  modules to fix runtime DI resolution (330+ handler/listener files)
- Offset CI docker-compose ports (5433/6380/8109/9002) to avoid
  conflicts with running dev containers
- Update .env.test, playwright.config.ts, and e2e workflow to use
  isolated CI ports with configurable overrides
- Fix prisma/seed.ts to use deterministic IDs for Prisma 7 upsert
  compatibility (phoneHash replaced phone as unique index)
- Add dedicated Docker bridge network for CI service containers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-13 01:40:14 +07:00
parent 1617921993
commit 25420720e7
345 changed files with 3266 additions and 924 deletions

View File

@@ -1,6 +1,6 @@
import { InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService, DomainException, NotFoundException, ValidationException } from '@modules/shared';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { LoggerService, PrismaService, DomainException, NotFoundException, ValidationException } from '@modules/shared';
import { CancelUserDeletionCommand } from './cancel-user-deletion.command';
@CommandHandler(CancelUserDeletionCommand)

View File

@@ -1,8 +1,8 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, UnauthorizedException, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type MfaService } from '../../../infrastructure/services/mfa.service';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, UnauthorizedException, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { MfaService } from '../../../infrastructure/services/mfa.service';
import { DisableMfaCommand } from './disable-mfa.command';
@CommandHandler(DisableMfaCommand)

View File

@@ -1,6 +1,6 @@
import { InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService, DomainException, NotFoundException } from '@modules/shared';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { LoggerService, PrismaService, DomainException, NotFoundException } from '@modules/shared';
import { ExportUserDataCommand } from './export-user-data.command';
export interface UserDataExport {

View File

@@ -1,7 +1,7 @@
import { InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { Prisma } from '@prisma/client';
import { type LoggerService, type PrismaService, DomainException, NotFoundException } from '@modules/shared';
import { LoggerService, PrismaService, DomainException, NotFoundException } from '@modules/shared';
import { ForceDeleteUserCommand } from './force-delete-user.command';
@CommandHandler(ForceDeleteUserCommand)

View File

@@ -1,12 +1,12 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { createId } from '@paralleldrive/cuid2';
import { type LoggerService, DomainException } from '@modules/shared';
import { LoggerService, DomainException } from '@modules/shared';
import {
MFA_CHALLENGE_REPOSITORY,
type IMfaChallengeRepository,
IMfaChallengeRepository,
} from '../../../domain/repositories/mfa-challenge.repository';
import { type TokenService, type TokenPair } from '../../../infrastructure/services/token.service';
import { TokenService, TokenPair } from '../../../infrastructure/services/token.service';
import { LoginUserCommand } from './login-user.command';
const MFA_CHALLENGE_TTL_MINUTES = 5;

View File

@@ -1,6 +1,6 @@
import { InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type CommandBus, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService, DomainException } from '@modules/shared';
import { CommandHandler, CommandBus, ICommandHandler } from '@nestjs/cqrs';
import { LoggerService, PrismaService, DomainException } from '@modules/shared';
import { ForceDeleteUserCommand } from '../force-delete-user/force-delete-user.command';
import { ProcessScheduledDeletionsCommand } from './process-scheduled-deletions.command';

View File

@@ -1,8 +1,8 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, DomainException, UnauthorizedException } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type TokenService, type TokenPair } from '../../../infrastructure/services/token.service';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { LoggerService, DomainException, UnauthorizedException } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { TokenService, TokenPair } from '../../../infrastructure/services/token.service';
import { RefreshTokenCommand } from './refresh-token.command';
@CommandHandler(RefreshTokenCommand)

View File

@@ -1,13 +1,13 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { createId } from '@paralleldrive/cuid2';
import { ConflictException, DomainException, type LoggerService, ValidationException } from '@modules/shared';
import { ConflictException, DomainException, LoggerService, ValidationException } from '@modules/shared';
import { UserEntity } from '../../../domain/entities/user.entity';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { Email } from '../../../domain/value-objects/email.vo';
import { HashedPassword } from '../../../domain/value-objects/hashed-password.vo';
import { Phone } from '../../../domain/value-objects/phone.vo';
import { type TokenService, type TokenPair } from '../../../infrastructure/services/token.service';
import { TokenService, TokenPair } from '../../../infrastructure/services/token.service';
import { RegisterUserCommand } from './register-user.command';
@CommandHandler(RegisterUserCommand)

View File

@@ -1,6 +1,6 @@
import { InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { type LoggerService, type PrismaService, DomainException, NotFoundException, ValidationException } from '@modules/shared';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { LoggerService, PrismaService, DomainException, NotFoundException, ValidationException } from '@modules/shared';
import { RequestUserDeletionCommand } from './request-user-deletion.command';
const DELETION_GRACE_PERIOD_DAYS = 30;

View File

@@ -1,8 +1,8 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type MfaService, type MfaSetupResult } from '../../../infrastructure/services/mfa.service';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { MfaService, MfaSetupResult } from '../../../infrastructure/services/mfa.service';
import { SetupMfaCommand } from './setup-mfa.command';
export interface SetupMfaResultDto {

View File

@@ -1,13 +1,13 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, UnauthorizedException } from '@modules/shared';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, UnauthorizedException } from '@modules/shared';
import {
MFA_CHALLENGE_REPOSITORY,
type IMfaChallengeRepository,
IMfaChallengeRepository,
} from '../../../domain/repositories/mfa-challenge.repository';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type MfaService } from '../../../infrastructure/services/mfa.service';
import { type TokenService, type TokenPair } from '../../../infrastructure/services/token.service';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { MfaService } from '../../../infrastructure/services/mfa.service';
import { TokenService, TokenPair } from '../../../infrastructure/services/token.service';
import { UseBackupCodeCommand } from './use-backup-code.command';
@CommandHandler(UseBackupCodeCommand)

View File

@@ -1,7 +1,7 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, NotFoundException, CacheService, CachePrefix } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, NotFoundException, CacheService, CachePrefix } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { VerifyKycCommand } from './verify-kyc.command';
@CommandHandler(VerifyKycCommand)

View File

@@ -1,13 +1,13 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, UnauthorizedException } from '@modules/shared';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, UnauthorizedException } from '@modules/shared';
import {
MFA_CHALLENGE_REPOSITORY,
type IMfaChallengeRepository,
IMfaChallengeRepository,
} from '../../../domain/repositories/mfa-challenge.repository';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type MfaService } from '../../../infrastructure/services/mfa.service';
import { type TokenService, type TokenPair } from '../../../infrastructure/services/token.service';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { MfaService } from '../../../infrastructure/services/mfa.service';
import { TokenService, TokenPair } from '../../../infrastructure/services/token.service';
import { VerifyMfaChallengeCommand } from './verify-mfa-challenge.command';
@CommandHandler(VerifyMfaChallengeCommand)

View File

@@ -1,8 +1,8 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { type MfaService } from '../../../infrastructure/services/mfa.service';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { MfaService } from '../../../infrastructure/services/mfa.service';
import { VerifyMfaSetupCommand } from './verify-mfa-setup.command';
export interface VerifyMfaSetupResultDto {

View File

@@ -1,6 +1,6 @@
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { type PrismaService, DomainException, type LoggerService } from '@modules/shared';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { PrismaService, DomainException, LoggerService } from '@modules/shared';
import { GetAgentByUserIdQuery } from './get-agent-by-user-id.query';
export interface AgentDto {

View File

@@ -1,7 +1,7 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, ValidationException } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { GetMfaStatusQuery } from './get-mfa-status.query';
export interface MfaStatusDto {

View File

@@ -1,7 +1,7 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService, NotFoundException, CacheService, CachePrefix, CacheTTL } from '@modules/shared';
import { USER_REPOSITORY, type IUserRepository } from '../../../domain/repositories/user.repository';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService, NotFoundException, CacheService, CachePrefix, CacheTTL } from '@modules/shared';
import { USER_REPOSITORY, IUserRepository } from '../../../domain/repositories/user.repository';
import { GetProfileQuery } from './get-profile.query';
export interface UserProfileDto {