Spaces:
Paused
Paused
| # Test script for the create_project endpoint using curl | |
| echo "Testing project creation via stored procedure..." | |
| # Create test payload | |
| cat > test_project.json << 'EOF' | |
| { | |
| "project_name": "Test Aqua Barrier Project", | |
| "project_location": "Los Angeles, CA", | |
| "project_type": "Commercial", | |
| "bid_date": "2024-01-15T10:00:00", | |
| "start_date": "2024-02-01T08:00:00", | |
| "is_awarded": true, | |
| "notes": "Test project for SP validation", | |
| "barrier_size": "50ft x 100ft", | |
| "lease_term": "12 months", | |
| "purchase_option": false, | |
| "lead_source": "Website", | |
| "rep": "John Doe", | |
| "engineer_company_id": 1, | |
| "engineer_notes": "Standard installation required", | |
| "engineer_company": "ABC Engineering", | |
| "status": 1, | |
| "customer_type_id": 1, | |
| "bill_name": "Test Company Inc", | |
| "bill_address1": "123 Main Street", | |
| "bill_address2": "Suite 100", | |
| "bill_city": "Los Angeles", | |
| "bill_state": "CA", | |
| "bill_zip": "90210", | |
| "bill_email": "billing@testcompany.com", | |
| "bill_phone": "555-123-4567", | |
| "ship_name": "Test Company Inc", | |
| "ship_address1": "456 Oak Avenue", | |
| "ship_city": "Los Angeles", | |
| "ship_state": "CA", | |
| "ship_zip": "90211", | |
| "ship_email": "shipping@testcompany.com", | |
| "ship_phone": "555-234-5678", | |
| "ship_office_phone": "555-345-6789", | |
| "acct_payable": "AP Department", | |
| "payment_term_id": 1, | |
| "payment_note": "Net 30", | |
| "rental_price_id": 1, | |
| "purchase_price_id": 1, | |
| "est_ship_date_id": 1, | |
| "fob_id": 1, | |
| "expedite_fee": "500.00", | |
| "est_freight_id": 1, | |
| "est_freight_fee": "250.00", | |
| "tax_rate": "8.25", | |
| "weekly_charge": "1500.00", | |
| "crew_members": 3, | |
| "tack_hoes": 2, | |
| "water_pump": 1, | |
| "water_pump2": 1, | |
| "pipes": 10, | |
| "timpers": 5, | |
| "est_installation_time": 8, | |
| "repair_kits": "Standard Kit", | |
| "installation_advisor": "Installation notes here...", | |
| "employee_id": "EMP001", | |
| "install_date": "2024-02-15T09:00:00", | |
| "commission": "1000.00", | |
| "advisor_id": "ADV001", | |
| "ship_via": "UPS Ground", | |
| "valid_for": "Quote valid for 30 days", | |
| "fas_dam": false | |
| } | |
| EOF | |
| echo "Making POST request to create project..." | |
| echo "" | |
| # Make the API call | |
| response=$(curl -s -w "\nHTTP_STATUS:%{http_code}\n" \ | |
| -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -d @test_project.json \ | |
| http://localhost:8000/api/v1/projects/) | |
| # Parse response | |
| http_status=$(echo "$response" | grep "HTTP_STATUS" | cut -d: -f2) | |
| response_body=$(echo "$response" | sed '/HTTP_STATUS/d') | |
| echo "HTTP Status: $http_status" | |
| echo "" | |
| if [ "$http_status" = "201" ]; then | |
| echo "✅ Project created successfully!" | |
| echo "Response:" | |
| echo "$response_body" | python -m json.tool 2>/dev/null || echo "$response_body" | |
| else | |
| echo "❌ Error creating project" | |
| echo "Response:" | |
| echo "$response_body" | |
| fi | |
| # Clean up | |
| rm -f test_project.json | |
| echo "" | |
| echo "Test completed." |