deckhearth/scripts/create-test-users.js
Randall Stillwell 72de168fc6 🎯 Complete Testing Workflow Setup
 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! 🚀
2025-07-25 10:42:00 -05:00

44 lines
1.3 KiB
JavaScript
Executable file
Raw Permalink Blame History

#!/usr/bin/env node
import { config } from 'dotenv';
import { sql } from '@vercel/postgres';
import bcrypt from 'bcryptjs';
// Load environment variables
config({ path: '.env.local' });
async function createTestUsers() {
try {
console.log('<27><> Creating test users...\n');
// Create Alice (collaborator)
const alicePassword = await bcrypt.hash('alice123', 12);
await sql`
INSERT INTO users (email, password, role)
VALUES ('alice@tcgvault.com', ${alicePassword}, 'user')
ON CONFLICT (email) DO NOTHING
`;
console.log('✅ Created Alice (alice@tcgvault.com / alice123)');
// Create Bob (collaborator)
const bobPassword = await bcrypt.hash('bob123', 12);
await sql`
INSERT INTO users (email, password, role)
VALUES ('bob@tcgvault.com', ${bobPassword}, 'user')
ON CONFLICT (email) DO NOTHING
`;
console.log('✅ Created Bob (bob@tcgvault.com / bob123)');
console.log('\n🎉 Test users created successfully!');
console.log('\n👥 Available Test Accounts:');
console.log(' 1. admin@tcgvault.com / admin123 (Admin)');
console.log(' 2. alice@tcgvault.com / alice123 (User)');
console.log(' 3. bob@tcgvault.com / bob123 (User)');
} catch (error) {
console.error('❌ Failed to create test users:', error.message);
process.exit(1);
}
}
createTestUsers();