Files
goodgo-platform/apps/api/src/instrument.ts
Ho Ngoc Hai a9fa214544 feat: comprehensive seed, Lucide icons, grouped dashboard nav, API fixes
- Rewrite prisma/seed.ts to populate all 27 models with realistic
  Vietnamese real estate data (8 users with login, 10 properties,
  10 listings, orders, payments, reviews, notifications, etc.)
- Replace all emoji icons with Lucide React SVG icons across frontend
  for consistent rendering, sizing, and accessibility
- Redesign dashboard nav: grouped sidebar with section headers,
  primary/secondary split on desktop, icon-only secondary items
- Replace language switcher flag emoji with Globe icon
- Replace SVG theme toggle with Lucide Moon/Sun icons
- Fix API startup: graceful fallback for Sentry profiling, Google OAuth,
  and Zalo OAuth when credentials are not configured
- Relax rate limiting in development mode (10k req/min)
- Fix listings API to include media[] array in search response
- Add optional chaining for property.media across frontend components
- Update OAuth strategy tests to match graceful fallback behavior

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-13 11:13:04 +07:00

28 lines
1.1 KiB
TypeScript

import * as Sentry from '@sentry/nestjs';
const isTest = process.env['NODE_ENV'] === 'test';
// Skip profiling integration in test env — the native binary may not be
// available for every Node.js version and it is unnecessary during E2E runs.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const integrations: any[] = [];
if (!isTest) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/consistent-type-imports
const { nodeProfilingIntegration } = require('@sentry/profiling-node') as typeof import('@sentry/profiling-node');
integrations.push(nodeProfilingIntegration());
} catch {
// Native CPU profiler binary not available — skip profiling gracefully.
console.warn('[Sentry] Profiling skipped — native module not available');
}
}
Sentry.init({
dsn: process.env['SENTRY_DSN'],
environment: process.env['NODE_ENV'] ?? 'development',
integrations,
tracesSampleRate: process.env['NODE_ENV'] === 'production' ? 0.2 : 1.0,
profilesSampleRate: process.env['NODE_ENV'] === 'production' ? 0.2 : 1.0,
enabled: !isTest && !!process.env['SENTRY_DSN'],
});