const { Client } = require('pg');

async function testProject() {
    const client = new Client({
        host: '87.106.21.21',
        port: 5432,
        user: 'enwelo_admin',
        password: 'WX1t1cgP1qK09',
        database: 'enwelo'
    });
    
    try {
        await client.connect();
        const input = 'BWSamern-Ohne'; 
        const normalized = input.toLowerCase().replace(/[-_]/g, '');
        const res = await client.query(
            'SELECT id FROM geodaten.projekte WHERE LOWER(REPLACE(REPLACE(name, \'-\', \'\'), \'_\', \'\')) = $1', 
            [normalized]
        );
        console.log(`Projekt ID für '${input}':`, res.rows.length > 0 ? res.rows[0].id : null);
    } catch (e) {
        console.error("Error:", e);
    } finally {
        await client.end();
    }
}
testProject();
