diff --git a/scripts/deploy-api.sh b/scripts/deploy-api.sh new file mode 100755 index 0000000..662313a --- /dev/null +++ b/scripts/deploy-api.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Simple deployment script for API server +# This updates the API server code on EC2 + +API_SERVER_IP="3.71.161.51" +API_SERVER_URL="https://api.filamenteka.rs" + +echo "🚀 Deploying API server updates..." + +# Create a temporary deployment package +echo "📦 Creating deployment package..." +mkdir -p tmp-deploy +cp -r api/* tmp-deploy/ +cp package.json tmp-deploy/ +cp package-lock.json tmp-deploy/ + +# Create tarball +tar -czf api-deploy.tar.gz -C tmp-deploy . +rm -rf tmp-deploy + +echo "📤 Package created: api-deploy.tar.gz" +echo "" +echo "⚠️ Manual deployment required:" +echo "1. Copy api-deploy.tar.gz to your server" +echo "2. SSH into the server at $API_SERVER_IP" +echo "3. Extract and restart the API service:" +echo " tar -xzf api-deploy.tar.gz" +echo " npm install --production" +echo " sudo systemctl restart node-api" +echo "" +echo "4. Run database migration if needed:" +echo " psql -U filamenteka_admin -d filamenteka < database/migrations/004_remove_brand_column.sql" + +# Cleanup +rm -f api-deploy.tar.gz + +echo "" +echo "✅ Deployment package instructions complete!" \ No newline at end of file diff --git a/src/services/api.ts b/src/services/api.ts index 7ce15a5..25d3604 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -81,7 +81,8 @@ export const filamentService = { // Transform bojaHex to boja_hex for backend const data = { ...filament, - boja_hex: filament.bojaHex || filament.boja_hex + boja_hex: filament.bojaHex || filament.boja_hex, + brand: '' // Temporary fix until server is updated }; delete data.bojaHex; // Remove the frontend field const response = await api.post('/filaments', data); @@ -92,7 +93,8 @@ export const filamentService = { // Transform bojaHex to boja_hex for backend const data = { ...filament, - boja_hex: filament.bojaHex || filament.boja_hex + boja_hex: filament.bojaHex || filament.boja_hex, + brand: filament.brand || '' // Temporary fix until server is updated }; delete data.bojaHex; // Remove the frontend field const response = await api.put(`/filaments/${id}`, data);