Admin Page work - Still blank/broken

This commit is contained in:
Eric Gullickson
2025-11-06 16:29:11 -06:00
parent 858cf31d38
commit 5630979adf
38 changed files with 7373 additions and 924 deletions

82
test-bulk-delete.sh Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/bash
# Test script for bulk catalog delete endpoint
# Note: This is a test script to verify the endpoint structure
BASE_URL="http://localhost/api"
echo "Testing bulk delete catalog endpoint"
echo "===================================="
echo ""
# Test 1: Invalid entity type
echo "Test 1: Invalid entity type (should return 400)"
curl -X DELETE "${BASE_URL}/admin/catalog/invalid/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [1, 2, 3]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 2: Empty IDs array
echo "Test 2: Empty IDs array (should return 400)"
curl -X DELETE "${BASE_URL}/admin/catalog/makes/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": []}' \
-w "\nStatus: %{http_code}\n\n"
# Test 3: Invalid IDs (negative numbers)
echo "Test 3: Invalid IDs - negative numbers (should return 400)"
curl -X DELETE "${BASE_URL}/admin/catalog/makes/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [1, -2, 3]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 4: Invalid IDs (strings instead of numbers)
echo "Test 4: Invalid IDs - strings (should return 400)"
curl -X DELETE "${BASE_URL}/admin/catalog/makes/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": ["abc", "def"]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 5: Valid request format (will fail without auth, but shows structure)
echo "Test 5: Valid request format - makes (needs auth)"
curl -X DELETE "${BASE_URL}/admin/catalog/makes/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [999, 998]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 6: Valid request format - models (needs auth)
echo "Test 6: Valid request format - models (needs auth)"
curl -X DELETE "${BASE_URL}/admin/catalog/models/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [999, 998]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 7: Valid request format - years (needs auth)
echo "Test 7: Valid request format - years (needs auth)"
curl -X DELETE "${BASE_URL}/admin/catalog/years/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [999, 998]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 8: Valid request format - trims (needs auth)
echo "Test 8: Valid request format - trims (needs auth)"
curl -X DELETE "${BASE_URL}/admin/catalog/trims/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [999, 998]}' \
-w "\nStatus: %{http_code}\n\n"
# Test 9: Valid request format - engines (needs auth)
echo "Test 9: Valid request format - engines (needs auth)"
curl -X DELETE "${BASE_URL}/admin/catalog/engines/bulk-delete" \
-H "Content-Type: application/json" \
-d '{"ids": [999, 998]}' \
-w "\nStatus: %{http_code}\n\n"
echo "===================================="
echo "Test script complete"
echo ""
echo "Expected results:"
echo "- Tests 1-4: Should return 400 (Bad Request)"
echo "- Tests 5-9: Should return 401 (Unauthorized) without auth token"
echo ""
echo "Note: Full testing requires admin authentication token"