const mysql = require('mysql2/promise');
require('dotenv').config();

async function check() {
    try {
        const db = await mysql.createConnection({
            host: process.env.DB_HOST || 'localhost',
            user: process.env.DB_USER || 'root',
            password: process.env.DB_PASSWORD || '',
            database: process.env.DB_NAME || 'license_manager_db',
            port: process.env.DB_PORT || 3307
        });
        const [rows] = await db.query("SELECT * FROM issued_licenses WHERE module_code = 'monitoring'");
        console.log('--- Monitoring Licenses ---');
        console.log(JSON.stringify(rows, null, 2));
        process.exit(0);
    } catch (err) {
        console.error(err);
        process.exit(1);
    }
}
check();
