const Database = require('better-sqlite3');
const path = require('path');
const dbPath = path.join(__dirname, 'data/school.db');
const db = new Database(dbPath);

console.log('--- USERS IN THE DATABASE ---');
try {
  const users = db.prepare('SELECT id, email, role, first_name, last_name, password FROM users').all();
  console.log(users.map(u => ({
    id: u.id,
    email: u.email,
    role: u.role,
    first_name: u.first_name,
    last_name: u.last_name,
    password_hash: u.password ? u.password.substring(0, 10) + '...' : 'NULL'
  })));
} catch (err) {
  console.error('Error fetching users:', err.message);
}
