const db = require('./config/database');
const bcrypt = require('bcryptjs');

async function checkUsers() {
  try {
    const [users] = await db.execute('SELECT id, email, user_type, school_id, password_hash FROM users WHERE user_type = "school"');
    
    console.log('School users:');
    for (const user of users) {
      console.log(`ID: ${user.id}, Email: ${user.email}, School: ${user.school_id}`);
      
      // Test password
      const isValid = await bcrypt.compare('school123', user.password_hash);
      console.log(`Password 'school123' valid: ${isValid}`);
      console.log('---');
    }
    
    process.exit(0);
  } catch (error) {
    console.error('Error:', error);
    process.exit(1);
  }
}

checkUsers();