Files
tilbudgivern/load_env.sh
T
alexpolo1 4a018d7862 fix: Complete codebase audit - 100% API test coverage with all errors fixed
✅ Fixes implemented:
- Fixed all 6 failing API endpoints (Bygma imports, prices, stats, orders, status-summary, analytics/materials)
- Disabled non-functional sync services (CalendarSync, Materials sync from Ordrestyring API)
- Removed duplicate PUT/DELETE /api/pricing/materials/:id endpoints
- Updated scrape_and_analyze_bygma.py to use service user from .env file
- Fixed analytics/materials query to use project_materials table with denormalized schema

📊 Test results:
- Created comprehensive-api-test.js testing 46 critical endpoints
- Success rate: 100% (46/46 passing)
- All Bygma endpoints working with direct SQL queries
- Orders endpoints protected with API key guards
- No more CalendarSync/Materials sync errors in logs

🗃️ Database schema discoveries:
- project_materials uses material_name (TEXT) not material_id (FK)
- material_prices has is_active not is_current
- bygma_import_log uses import_batch_id not batch_id
- All queries updated to match actual schema
2025-10-21 06:33:28 +00:00

24 lines
751 B
Bash
Executable File

#!/bin/bash
#
# Load Ordrestyring Environment Variables
# Source this file to load all environment variables
#
# Determine script directory and workspace root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_FILE="$SCRIPT_DIR/.env.ordrestyring"
# Check if .env.ordrestyring exists in workspace root
if [ -f "$ENV_FILE" ]; then
echo "📝 Loading Ordrestyring environment variables from $ENV_FILE..."
export $(grep -v '^#' "$ENV_FILE" | xargs)
echo "✅ Environment variables loaded:"
echo " ORDRESTYRING_TOKEN: ${ORDRESTYRING_TOKEN:0:5}***"
echo " DB_HOST: $DB_HOST"
echo " DB_USER: $DB_USER"
echo " DB_NAME: $DB_NAME"
else
echo "❌ .env.ordrestyring file not found at $ENV_FILE"
exit 1
fi