import { pool } from '../db.js';

async function checkRecentUsers() {
  try {
    console.log('📋 Derniers utilisateurs créés:\n');

    const result = await pool.query(`
      SELECT id, email, first_name, last_name, role, is_verified, created_at
      FROM users
      ORDER BY created_at DESC
      LIMIT 10
    `);

    result.rows.forEach(user => {
      console.log(`  ${user.email}`);
      console.log(`    Rôle: ${user.role}`);
      console.log(`    Nom: ${user.first_name} ${user.last_name}`);
      console.log(`    Vérifié: ${user.is_verified ? '✓' : '✗'}`);
      console.log(`    Créé: ${user.created_at}`);
      console.log(`    ID: ${user.id}\n`);
    });

    process.exit(0);
  } catch (error) {
    console.error('❌ Erreur:', error.message);
    process.exit(1);
  }
}

checkRecentUsers();
