#!/usr/bin/env python3 """ Test script to verify the models are correctly defined """ # Test imports try: from models.user import User, UserModel, UserIDRequest, RegisterUserRequest print("✅ User models imported successfully") except ImportError as e: print(f"❌ Error importing user models: {e}") try: from models.items import Product, ProductWithQuantity print("✅ Product models imported successfully") except ImportError as e: print(f"❌ Error importing product models: {e}") try: from models.sells import Sale, SellItem, ItemWeb, OrderWeb print("✅ Sales models imported successfully") except ImportError as e: print(f"❌ Error importing sales models: {e}") try: from models.blacklist import Blacklist print("✅ Blacklist model imported successfully") except ImportError as e: print(f"❌ Error importing blacklist model: {e}") try: from models.chat import Message, ChatCompletionRequest print("✅ Chat models imported successfully") except ImportError as e: print(f"❌ Error importing chat models: {e}") # Test model creation try: user = User( id=1, email="test@example.com", nombre="Test User", rut="12345678-9", pin_hash="hashed_pin", kleincoins="100", created_at="2023-01-01T00:00:00" ) print("✅ User model creation successful") print(f" User: {user.nombre} ({user.email})") except Exception as e: print(f"❌ Error creating user model: {e}") try: product = Product( id=1, name="Test Product", type="food", description="A test product", price=10.99, image="test.jpg", status=1 ) print("✅ Product model creation successful") print(f" Product: {product.name} - ${product.price}") except Exception as e: print(f"❌ Error creating product model: {e}") try: product_with_quantity = ProductWithQuantity( id=1, name="Test Product", type="food", description="A test product", price=10.99, image="test.jpg", status=1, cantidad=3 ) print("✅ ProductWithQuantity model creation successful") print(f" Product: {product_with_quantity.name} - Qty: {product_with_quantity.cantidad}") except Exception as e: print(f"❌ Error creating ProductWithQuantity model: {e}") try: sale = Sale( id=1, user_id=1, total=50.99, fudo_id="FUDO123", fecha="2023-01-01T12:00:00", table=5, user_name="Test User", user_email="test@example.com" ) print("✅ Sale model creation successful") print(f" Sale: {sale.fudo_id} - Total: ${sale.total}") except Exception as e: print(f"❌ Error creating sale model: {e}") try: blacklist = Blacklist( id=1, user_id=1, email="blocked@example.com", nombre="Blocked User", rut="98765432-1" ) print("✅ Blacklist model creation successful") print(f" Blacklisted: {blacklist.nombre} ({blacklist.email})") except Exception as e: print(f"❌ Error creating blacklist model: {e}") print("\n🎉 All model tests completed!")