Add temporary brand field fix and deployment script
- Add empty brand field to API requests until server is updated - Create deployment script for updating API server - This fixes the 500 error when adding/editing filaments
This commit is contained in:
39
scripts/deploy-api.sh
Executable file
39
scripts/deploy-api.sh
Executable file
@@ -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!"
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user