Enhance configuration and authentication features across services

- Updated `next.config.js` in both web-admin and web-client to enable React strict mode, set output to standalone, and expose environment variables for API URL.
- Enhanced `auth-sdk` with detailed comments for JWT verification, decoding, and token management functions.
- Improved `http-client` with comprehensive documentation for HTTP client configuration and methods.
- Expanded `logger` functionality with detailed configuration options and logging formats.
- Enhanced `tracing` setup with detailed comments for distributed tracing configuration.
- Updated `types` definitions for authentication and user data transfer objects with comprehensive comments.
- Improved `auth-service` with detailed comments in controllers, services, and middlewares for better clarity and maintainability.
- Added health check endpoints in `health.controller.ts` for service monitoring.
- Enhanced error handling and logging throughout the application for better debugging and user feedback.
This commit is contained in:
Ho Ngoc Hai
2025-12-27 01:37:59 +07:00
parent 4da46b5b8e
commit 526f376c5f
24 changed files with 883 additions and 89 deletions

View File

@@ -1,39 +1,49 @@
#!/bin/bash
# EN: Database migration script for individual services
# VI: Script migration database cho từng service riêng lẻ
set -e
SERVICE=$1
# EN: Validate service name parameter
# VI: Xác thực tham số tên service
if [ -z "$SERVICE" ]; then
echo "Usage: $0 <service-name> [dev|deploy]"
echo "Example: $0 auth-service dev"
echo "Example: $0 auth-service deploy"
echo "Usage: $0 <service-name> [dev|deploy] / Cách dùng: $0 <tên-service> [dev|deploy]"
echo "Example: $0 auth-service dev / Ví dụ: $0 auth-service dev"
echo "Example: $0 auth-service deploy / Ví dụ: $0 auth-service deploy"
exit 1
fi
# EN: Check if service directory exists
# VI: Kiểm tra thư mục service có tồn tại không
if [ ! -d "services/$SERVICE" ]; then
echo "❌ Service $SERVICE not found"
echo "❌ Service $SERVICE not found / Không tìm thấy service $SERVICE"
exit 1
fi
echo "🔄 Running migrations for $SERVICE..."
echo "🔄 Running migrations for $SERVICE... / Chạy migrations cho $SERVICE..."
cd "services/$SERVICE"
# Load environment variables (hybrid pattern)
# 1. Load shared env (JWT secrets, Redis config)
# EN: Load environment variables (hybrid pattern)
# VI: Load biến môi trường (hybrid pattern)
# EN: 1. Load shared env (JWT secrets, Redis config)
# VI: 1. Load shared env (JWT secrets, Redis config)
if [ -f "../../deployments/local/.env.local" ]; then
export $(grep -v '^#' ../../deployments/local/.env.local | xargs)
fi
# 2. Load service-specific env (DATABASE_URL, PORT, etc.)
# EN: 2. Load service-specific env (DATABASE_URL, PORT, etc.)
# VI: 2. Load service-specific env (DATABASE_URL, PORT, etc.)
if [ -f ".env.local" ]; then
export $(grep -v '^#' .env.local | xargs)
fi
# Check if DATABASE_URL is set
# EN: Check if DATABASE_URL is set
# VI: Kiểm tra DATABASE_URL có được thiết lập không
if [ -z "$DATABASE_URL" ]; then
echo "⚠️ DATABASE_URL not set. Please check your .env.local files:"
echo "⚠️ DATABASE_URL not set. Please check your .env.local files: / DATABASE_URL chưa được thiết lập. Vui lòng kiểm tra file .env.local:"
echo " - Shared config: ../../deployments/local/.env.local"
echo " - Service config: .env.local"
echo " For Neon: postgresql://user:pass@ep-xxx.region.neon.tech/dbname?sslmode=require&pgbouncer=true"