Files
moto-adv-website/migrations/add_category_to_chat_rooms.py
ske087 30bd4c62ad Major Feature Update: Modern Chat System & Admin Management
Features Added:
🔥 Modern Chat System:
- Real-time messaging with modern Tailwind CSS design
- Post-linked discussions for adventure sharing
- Chat categories (general, technical-support, adventure-planning)
- Mobile-responsive interface with gradient backgrounds
- JavaScript polling for live message updates

🎯 Comprehensive Admin Panel:
- Chat room management with merge capabilities
- Password reset system with email templates
- User management with admin controls
- Chat statistics and analytics dashboard
- Room binding to posts and categorization

�� Mobile API Integration:
- RESTful API endpoints at /api/v1/chat
- Session-based authentication for mobile apps
- Comprehensive endpoints for rooms, messages, users
- Mobile app compatibility (React Native, Flutter)

🛠️ Technical Improvements:
- Enhanced database models with ChatRoom categories
- Password reset token system with email verification
- Template synchronization fixes for Docker deployment
- Migration scripts for database schema updates
- Improved error handling and validation

🎨 UI/UX Enhancements:
- Modern card-based layouts matching app design
- Consistent styling across chat and admin interfaces
- Mobile-optimized touch interactions
- Professional gradient designs and glass morphism effects

📚 Documentation:
- Updated README with comprehensive API documentation
- Added deployment instructions for Docker (port 8100)
- Configuration guide for production environments
- Mobile integration examples and endpoints

This update transforms the platform into a comprehensive motorcycle adventure community with modern chat capabilities and professional admin management tools.
2025-08-10 00:22:33 +03:00

40 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Database migration to add category field to chat_rooms table
"""
from app.extensions import db
def upgrade():
"""Add category field to chat_rooms table"""
try:
# Add the category column
db.engine.execute("""
ALTER TABLE chat_rooms
ADD COLUMN category VARCHAR(50) DEFAULT 'general'
""")
# Update existing rooms to have category based on room_type
db.engine.execute("""
UPDATE chat_rooms
SET category = CASE
WHEN room_type = 'general' THEN 'general'
WHEN room_type = 'post_discussion' THEN 'general'
WHEN room_type = 'admin_support' THEN 'technical'
WHEN room_type = 'password_reset' THEN 'technical'
ELSE 'general'
END
""")
print("✅ Successfully added category field to chat_rooms table")
except Exception as e:
print(f"❌ Error adding category field: {e}")
# If column already exists, that's fine
if "duplicate column name" in str(e).lower() or "already exists" in str(e).lower():
print(" Category column already exists")
else:
raise
if __name__ == "__main__":
upgrade()