Backend (7 fixes):
- wallet-service: remove conflicting EF Ignore() calls for mapped backing fields
- fnb-engine: remove KitchenTicket short constructor that set productId=orderItemId
- fnb-engine: replace fire-and-forget Task.Run with direct await for inventory deduction
- TenantMiddleware: implement PostgreSQL RLS SET LOCAL in 4 services (wallet, fnb, inventory, catalog)
- order-service: fix SQL injection pattern in TenantMiddleware with Guid.ToString("D")
- order-service: add ValidateShopAccess() authorization check in SignalR PosHub
- 4 services: register IDbConnection (NpgsqlConnection) in DI for RLS middleware
Frontend (3 fixes):
- PosDataService: return Success=false (not true) when PayOrder response parsing fails
- QrPayment: add _disposed guard to prevent timer race condition after component disposal
- BFF OrderController: add [Authorize] attribute to require JWT for all endpoints
Infrastructure (3 fixes):
- docker-compose: upgrade PostgreSQL 15-alpine to 16-alpine per project spec
- init-databases.sh: add 4 missing marketing service databases (mkt_*)
- Traefik routes: add wallet, catalog, booking routers and /api/v1/stock path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# =============================================================================
|
|
# GoodGo Platform - PostgreSQL Database Initialization Script
|
|
# =============================================================================
|
|
# EN: Creates all required databases for each microservice on first startup.
|
|
# VI: Tạo tất cả databases cần thiết cho từng microservice khi khởi động lần đầu.
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
DATABASES=(
|
|
"ads_analytics_service"
|
|
"ads_billing_service"
|
|
"ads_manager_service"
|
|
"ads_serving_service"
|
|
"ads_tracking_service"
|
|
"booking_service"
|
|
"catalog_service"
|
|
"chat_service"
|
|
"fnb_engine"
|
|
"iam_service"
|
|
"inventory_service"
|
|
"membership_service"
|
|
"merchant_service"
|
|
"mining_service"
|
|
"mission_service"
|
|
"mkt_facebook_service"
|
|
"mkt_whatsapp_service"
|
|
"mkt_x_service"
|
|
"mkt_zalo_service"
|
|
"order_service"
|
|
"promotion_service"
|
|
"social_service"
|
|
"storage_service"
|
|
"wallet_service"
|
|
)
|
|
|
|
echo "=== GoodGo: Creating databases ==="
|
|
|
|
for DB_NAME in "${DATABASES[@]}"; do
|
|
echo "Creating database: $DB_NAME"
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
|
SELECT 'CREATE DATABASE $DB_NAME'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$DB_NAME')\gexec
|
|
EOSQL
|
|
done
|
|
|
|
echo "=== GoodGo: All databases created successfully ==="
|