import mysql from 'mysql2/promise';
import dotenv from 'dotenv';
import path from 'path';

dotenv.config({ path: 'c:/xampp/htdocs/hannoole/NESOS/backend/.env' });

async function checkUsers() {
  const connection = await mysql.createConnection({
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME,
    port: process.env.DB_PORT
  });

  const [rows] = await connection.execute('SELECT email, role FROM users');
  console.log('Users in DB:');
  console.table(rows);
  await connection.end();
}

checkUsers().catch(console.error);
