2025-07-25 11:42:00 -04:00
|
|
|
|
#!/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)
|
2026-05-25 02:58:48 -04:00
|
|
|
|
VALUES ('alice@deckhearth.com', ${alicePassword}, 'user')
|
2025-07-25 11:42:00 -04:00
|
|
|
|
ON CONFLICT (email) DO NOTHING
|
|
|
|
|
|
`;
|
2026-05-25 02:58:48 -04:00
|
|
|
|
console.log('✅ Created Alice (alice@deckhearth.com / alice123)');
|
2025-07-25 11:42:00 -04:00
|
|
|
|
|
|
|
|
|
|
// Create Bob (collaborator)
|
|
|
|
|
|
const bobPassword = await bcrypt.hash('bob123', 12);
|
|
|
|
|
|
await sql`
|
|
|
|
|
|
INSERT INTO users (email, password, role)
|
2026-05-25 02:58:48 -04:00
|
|
|
|
VALUES ('bob@deckhearth.com', ${bobPassword}, 'user')
|
2025-07-25 11:42:00 -04:00
|
|
|
|
ON CONFLICT (email) DO NOTHING
|
|
|
|
|
|
`;
|
2026-05-25 02:58:48 -04:00
|
|
|
|
console.log('✅ Created Bob (bob@deckhearth.com / bob123)');
|
2025-07-25 11:42:00 -04:00
|
|
|
|
|
|
|
|
|
|
console.log('\n🎉 Test users created successfully!');
|
|
|
|
|
|
console.log('\n👥 Available Test Accounts:');
|
2026-05-25 02:58:48 -04:00
|
|
|
|
console.log(' 1. admin@deckhearth.com / admin123 (Admin)');
|
|
|
|
|
|
console.log(' 2. alice@deckhearth.com / alice123 (User)');
|
|
|
|
|
|
console.log(' 3. bob@deckhearth.com / bob123 (User)');
|
2025-07-25 11:42:00 -04:00
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('❌ Failed to create test users:', error.message);
|
|
|
|
|
|
process.exit(1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
createTestUsers();
|