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,23 +1,34 @@
# =============================================================================
# GoodGo Platform — Test Environment Variables
# Used by E2E tests (Playwright globalSetup loads this automatically)
#
# These values MUST match docker-compose.ci.yml service credentials.
# Ports use CI_* offsets to avoid conflicts with dev containers.
# =============================================================================
# Test database — separate from development DB for isolation
DATABASE_URL=postgresql://goodgo:goodgo_secret@localhost:5432/goodgo_test?schema=public
# Test database — matches docker-compose.ci.yml postgres service
# Port 5433 avoids conflict with dev postgres on 5432
DATABASE_URL=postgresql://goodgo:goodgo_test_secret@localhost:5433/goodgo_test?schema=public
# Services (same as dev, adjust if your test infra differs)
REDIS_URL=redis://localhost:6379
# Redis — matches docker-compose.ci.yml redis service
# Port 6380 avoids conflict with dev redis on 6379
REDIS_URL=redis://localhost:6380
REDIS_HOST=localhost
REDIS_PORT=6380
# Typesense — matches docker-compose.ci.yml typesense service
# Port 8109 avoids conflict with dev typesense on 8108
TYPESENSE_HOST=localhost
TYPESENSE_PORT=8108
TYPESENSE_PORT=8109
TYPESENSE_PROTOCOL=http
TYPESENSE_API_KEY=ts_dev_key_change_me
TYPESENSE_API_KEY=ts_ci_key
# MinIO
# MinIO — matches docker-compose.ci.yml minio service
# Port 9002 avoids conflict with dev minio on 9000
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_ACCESS_KEY=test_minio_user
MINIO_SECRET_KEY=test_minio_secret_key_32chars!!
MINIO_PORT=9002
MINIO_ACCESS_KEY=ci_minio_user
MINIO_SECRET_KEY=ci_minio_secret_key_32chars!!
MINIO_BUCKET=goodgo-uploads
# Auth (deterministic secrets for test reproducibility)
@@ -27,6 +38,12 @@ JWT_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7d
NODE_ENV=test
# Server ports — offset to avoid conflicts with dev
API_PORT=3011
WEB_PORT=3010
API_BASE_URL=http://localhost:3011/api/v1/
WEB_BASE_URL=http://localhost:3010
# Bcrypt (fast rounds for test — production uses 12+)
BCRYPT_ROUNDS=4