deckhearth/pages/api/cards
Randall Stillwell 9d7278f8f5 🔧 Fix Card Ownership & Auto-Sync with 'All My Cards'
🐛 Database Fixes:
- Added unique constraint on user_cards (user_id, card_id)
- Added unique constraint on collection_cards (collection_id, card_id)
- Fixed ON CONFLICT clauses in card ownership API

 Auto-Sync Feature:
- Card ownership now automatically syncs with 'All My Cards' collection
- When user marks card as owned → added to system collection
- When user removes ownership → removed from system collection
- Real-time bidirectional sync between user_cards and collection_cards

🔄 Migration Script:
- Cleaned up any duplicate entries
- Added necessary database constraints
- Synced existing owned cards (0 users had existing data)

🎯 API Improvements:
- Simplified card ownership API (removed GET method)
- Better error handling and validation
- Clear success messages for user feedback
- Automatic collection management

Card ownership should now work perfectly! 🚀
2025-07-27 15:21:43 -05:00
..
[id] 🔧 Fix Card Ownership & Auto-Sync with 'All My Cards' 2025-07-27 15:21:43 -05:00
[id].js Created comprehensive admin card editor 2025-07-24 15:16:57 -05:00
import-lorcana.js Add real Lorcana import using Lorcast API 2025-07-24 12:27:10 -05:00
import-mtg.js Major redesign: Enhanced card display with particle effects, improved filters, and search functionality 2025-07-23 21:26:54 -05:00
import-pokemon.js Fix import issues: Add retry logic and better error handling 2025-07-24 10:30:21 -05:00
search.js 🔧 Fix Database Schema Mismatch in Cards API 2025-07-26 10:27:45 -05:00