REFACTOR API gateway fix 5

This commit is contained in:
Urtzi Alfaro
2025-07-26 21:10:54 +02:00
parent dacf114922
commit 7d5c8bc9a4
6 changed files with 91 additions and 19 deletions

View File

@@ -181,6 +181,36 @@ if [ -n "$TENANT_ID" ]; then
echo "Validation Response: $VALIDATION_RESPONSE"
check_response "$VALIDATION_RESPONSE" "Import Validation"
# Step 6.5: Import Sample Sales Data
echo -e "\n6.5. Importing Sample Sales Data..."
IMPORT_RESPONSE=$(curl -s -X POST "$API_BASE/api/v1/tenants/$TENANT_ID/sales" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"product_name": "Pan Integral",
"quantity_sold": 25,
"revenue": 37.50,
"date": "2024-01-15T10:00:00Z"
}')
echo "Import Response: $IMPORT_RESPONSE"
check_response "$IMPORT_RESPONSE" "Sales Data Import"
# Now test sales endpoint again - should have data!
echo -e "\n6.6. Testing Sales Endpoint Again (Should Have Data)..."
SALES_RESPONSE_WITH_DATA=$(curl -s -X GET "$API_BASE/api/v1/tenants/$TENANT_ID/sales" \
-H "Authorization: Bearer $ACCESS_TOKEN")
echo "Sales Response with Data: $SALES_RESPONSE_WITH_DATA"
check_response "$SALES_RESPONSE_WITH_DATA" "Tenant Sales Endpoint with Data"
# Check if we actually got data
if echo "$SALES_RESPONSE_WITH_DATA" | grep -q "Pan Integral"; then
echo -e "${GREEN}✅ Successfully retrieved sales data!${NC}"
else
echo -e "${YELLOW}⚠️ No sales data returned (might need different import endpoint)${NC}"
fi
fi
# Step 7: Additional Debug Information