apskel-pos-backend/test_product_image_printer.sh
Aditya Siregar a759e0f57c init
2025-07-30 23:18:20 +07:00

51 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Test script for product image and printer_type functionality
echo "Testing Product Image and Printer Type Integration..."
# Build the application
echo "Building application..."
go build -o server cmd/server/main.go
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
echo "Build successful!"
# Run database migrations
echo "Running database migrations..."
migrate -path migrations -database "postgres://postgres:password@localhost:5432/pos_db?sslmode=disable" up
if [ $? -ne 0 ]; then
echo "Migration failed!"
exit 1
fi
echo "Migrations completed successfully!"
echo "Product Image and Printer Type Integration Test Complete!"
echo ""
echo "Features implemented:"
echo "1. ✅ Database Migration (migrations/000024_add_image_and_printer_type_to_products.up.sql)"
echo "2. ✅ Product Entity Updated (internal/entities/product.go)"
echo "3. ✅ Product Models Updated (internal/models/product.go)"
echo "4. ✅ Product Mapper Updated (internal/mappers/product_mapper.go)"
echo "5. ✅ Default Printer Type: 'kitchen'"
echo "6. ✅ Image URL Support (VARCHAR(500))"
echo "7. ✅ Printer Type Support (VARCHAR(50))"
echo ""
echo "New Product Fields:"
echo "- image_url: Optional image URL for product display"
echo "- printer_type: Printer type for order printing (default: 'kitchen')"
echo ""
echo "API Changes:"
echo "- CreateProductRequest: Added image_url and printer_type fields"
echo "- UpdateProductRequest: Added image_url and printer_type fields"
echo "- ProductResponse: Added image_url and printer_type fields"
echo ""
echo "Database Changes:"
echo "- Added image_url column (VARCHAR(500), nullable)"
echo "- Added printer_type column (VARCHAR(50), default 'kitchen')"
echo "- Added index on printer_type for efficient filtering"