mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
hot fix #1
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Fixing Admin Issues ==="
|
||||
|
||||
# Step 1: Run database migrations
|
||||
echo "Step 1: Running database migrations..."
|
||||
cd /home/tdvorak/Desktop/PROG+HTML/Fotbal/fotbal-club
|
||||
go run main.go migrate-up
|
||||
|
||||
# Step 2: Check if backend is running
|
||||
echo "Step 2: Checking backend status..."
|
||||
if curl -s http://localhost:8080/api/v1/health > /dev/null; then
|
||||
echo "Backend is already running"
|
||||
else
|
||||
echo "Starting backend..."
|
||||
# Start backend in background
|
||||
go run main.go &
|
||||
BACKEND_PID=$!
|
||||
echo "Backend started with PID: $BACKEND_PID"
|
||||
|
||||
# Wait for backend to start
|
||||
echo "Waiting for backend to start..."
|
||||
for i in {1..30}; do
|
||||
if curl -s http://localhost:8080/api/v1/health > /dev/null; then
|
||||
echo "Backend is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting... ($i/30)"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
# Step 3: Test the problematic endpoints
|
||||
echo "Step 3: Testing endpoints..."
|
||||
|
||||
echo "Testing QR codes endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" http://localhost:8080/api/v1/admin/qr-codes || echo "QR codes endpoint failed"
|
||||
|
||||
echo "Testing expenses endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" "http://localhost:8080/api/v1/admin/financial/expenses?page=1&limit=20" || echo "Expenses endpoint failed"
|
||||
|
||||
echo "Testing expenses categories endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" http://localhost:8080/api/v1/admin/financial/expenses/categories || echo "Expenses categories endpoint failed"
|
||||
|
||||
echo "Testing invoices endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" http://localhost:8080/api/v1/admin/invoices || echo "Invoices endpoint failed"
|
||||
|
||||
echo "Testing customers endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" http://localhost:8080/api/v1/admin/invoices/customers || echo "Customers endpoint failed"
|
||||
|
||||
echo "Testing invoice settings endpoint..."
|
||||
curl -s -w "\nStatus: %{http_code}\n" http://localhost:8080/api/v1/admin/invoices/settings || echo "Invoice settings endpoint failed"
|
||||
|
||||
echo "=== Fix Complete ==="
|
||||
echo "If you see 404 errors, the routes might not be properly registered."
|
||||
echo "If you see 500 errors, the database tables might not exist or there are database issues."
|
||||
echo "Check the backend logs for more details."
|
||||
Reference in New Issue
Block a user