✅ Database & API Fixes: - Fixed collection detail API to use correct column names (card_type, market_price, image_url) - Removed all mock data and fallbacks - Updated field mappings throughout collection detail page - Fixed hero section to use real collection data with proper image support �� Test Users Created: - admin@tcgvault.com / admin123 (Admin) - alice@tcgvault.com / alice123 (User) - bob@tcgvault.com / bob123 (User) 🃏 Sample Cards Added: - Lightning Bolt (MTG) - $2.50 - Black Lotus (MTG) - $25,000 - Pikachu (Pokemon) - $8.50 - Charizard (Pokemon) - $350 - Mickey Mouse (Lorcana) - $45 - Elsa (Lorcana) - $15.75 🔧 Collaboration Features: - Added CollaborationManager to collection detail page - Integrated real user permissions (isOwner check) - Updated hero section with real stats and creator info 🔍 Card Management: - Created cards search API (/api/cards/search) - Implemented quick add functionality in empty state - Real-time card search with dropdown results - Add cards directly to collection with quantity �� Ready for Testing: 1. Login as any user to see only their collections 2. Create collections with real data 3. Add cards using search functionality 4. Invite collaborators via email system 5. Switch users to test collaboration workflow Complete end-to-end testing environment ready! 🚀
125 lines
4.2 KiB
JavaScript
Executable file
125 lines
4.2 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
|
|
import { config } from 'dotenv';
|
|
import { sql } from '@vercel/postgres';
|
|
|
|
// Load environment variables
|
|
config({ path: '.env.local' });
|
|
|
|
async function createSampleCards() {
|
|
try {
|
|
console.log('🃏 Creating sample cards...\n');
|
|
|
|
const sampleCards = [
|
|
{
|
|
name: 'Lightning Bolt',
|
|
set_name: 'Alpha',
|
|
set_code: 'LEA',
|
|
card_number: '161',
|
|
rarity: 'Common',
|
|
game: 'MTG',
|
|
mana_cost: '{R}',
|
|
cmc: 1,
|
|
card_type: 'Instant',
|
|
colors: '["Red"]',
|
|
oracle_text: 'Lightning Bolt deals 3 damage to any target.',
|
|
image_url: 'https://cards.scryfall.io/normal/front/c/e/ce711943-c1a1-43a0-8b89-8d169cfb8e06.jpg',
|
|
market_price: 2.50
|
|
},
|
|
{
|
|
name: 'Black Lotus',
|
|
set_name: 'Alpha',
|
|
set_code: 'LEA',
|
|
card_number: '232',
|
|
rarity: 'Rare',
|
|
game: 'MTG',
|
|
mana_cost: '{0}',
|
|
cmc: 0,
|
|
card_type: 'Artifact',
|
|
colors: '[]',
|
|
oracle_text: '{T}, Sacrifice Black Lotus: Add three mana of any one color.',
|
|
image_url: 'https://cards.scryfall.io/normal/front/b/d/bd8fa327-dd41-4737-8f19-2cf5eb1f7cdd.jpg',
|
|
market_price: 25000.00
|
|
},
|
|
{
|
|
name: 'Pikachu',
|
|
set_name: 'Base Set',
|
|
set_code: 'BS1',
|
|
card_number: '25',
|
|
rarity: 'Common',
|
|
game: 'Pokemon',
|
|
card_type: 'Basic Pokemon',
|
|
oracle_text: 'When several of these Pokemon gather, their electricity could build and cause lightning storms.',
|
|
image_url: 'https://images.pokemontcg.io/base1/25_hires.png',
|
|
market_price: 8.50
|
|
},
|
|
{
|
|
name: 'Charizard',
|
|
set_name: 'Base Set',
|
|
set_code: 'BS1',
|
|
card_number: '4',
|
|
rarity: 'Rare Holo',
|
|
game: 'Pokemon',
|
|
card_type: 'Stage 2 Pokemon',
|
|
oracle_text: 'Spits fire that is hot enough to melt boulders. Known to cause forest fires unintentionally.',
|
|
image_url: 'https://images.pokemontcg.io/base1/4_hires.png',
|
|
market_price: 350.00
|
|
},
|
|
{
|
|
name: 'Mickey Mouse - Brave Little Tailor',
|
|
set_name: 'The First Chapter',
|
|
set_code: 'TFC',
|
|
card_number: '1',
|
|
rarity: 'Legendary',
|
|
game: 'Lorcana',
|
|
card_type: 'Character',
|
|
oracle_text: 'Bravery - When you play this character, you may banish chosen character.',
|
|
image_url: 'https://cdn.lorcana-api.com/images/tfc/001_en_mickey_mouse-716.webp',
|
|
market_price: 45.00
|
|
},
|
|
{
|
|
name: 'Elsa - Snow Queen',
|
|
set_name: 'The First Chapter',
|
|
set_code: 'TFC',
|
|
card_number: '43',
|
|
rarity: 'Super Rare',
|
|
game: 'Lorcana',
|
|
card_type: 'Character',
|
|
oracle_text: 'Deep Freeze - Exert chosen character. They can\'t ready at the start of their next turn.',
|
|
image_url: 'https://cdn.lorcana-api.com/images/tfc/043_en_elsa-716.webp',
|
|
market_price: 15.75
|
|
}
|
|
];
|
|
|
|
for (const card of sampleCards) {
|
|
await sql`
|
|
INSERT INTO cards (
|
|
name, set_name, set_code, card_number, rarity, game,
|
|
mana_cost, cmc, card_type, colors, oracle_text,
|
|
image_url, market_price, verified
|
|
) VALUES (
|
|
${card.name}, ${card.set_name}, ${card.set_code}, ${card.card_number},
|
|
${card.rarity}, ${card.game}, ${card.mana_cost || null}, ${card.cmc || null},
|
|
${card.card_type}, ${card.colors || null}, ${card.oracle_text},
|
|
${card.image_url}, ${card.market_price}, true
|
|
)
|
|
`;
|
|
console.log(`✅ Added ${card.name} (${card.game})`);
|
|
}
|
|
|
|
console.log('\n🎉 Sample cards created successfully!');
|
|
console.log('\n🃏 Available Cards:');
|
|
console.log(' • Lightning Bolt (MTG) - $2.50');
|
|
console.log(' • Black Lotus (MTG) - $25,000');
|
|
console.log(' • Pikachu (Pokemon) - $8.50');
|
|
console.log(' • Charizard (Pokemon) - $350');
|
|
console.log(' • Mickey Mouse (Lorcana) - $45');
|
|
console.log(' • Elsa (Lorcana) - $15.75');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Failed to create sample cards:', error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
createSampleCards();
|