35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
const { Client } = require('pg');
|
|
|
|
const client = new Client({
|
|
host: '66.116.207.225',
|
|
port: 5433,
|
|
database: 'nearledb',
|
|
user: 'admin',
|
|
password: 'Package@123#',
|
|
ssl: false,
|
|
});
|
|
|
|
async function main() {
|
|
try {
|
|
await client.connect();
|
|
console.log('Connected to PostgreSQL successfully!');
|
|
|
|
// Get Suriya Store locations
|
|
const locationsRes = await client.query('SELECT locationid, tenantid, locationname, email, contactno, status FROM tenantlocations WHERE tenantid = 1135');
|
|
console.log('\n--- SURIYA STORE LOCATIONS (tenantid = 1135) ---');
|
|
console.table(locationsRes.rows);
|
|
|
|
// Get all users associated with tenantid = 1135
|
|
const usersRes = await client.query('SELECT userid, authname, firstname, email, contactno, roleid, locationid, status FROM app_users WHERE tenantid = 1135');
|
|
console.log('\n--- USERS ASSOCIATED WITH tenantid = 1135 ---');
|
|
console.table(usersRes.rows);
|
|
|
|
} catch (err) {
|
|
console.error('Error connecting:', err);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
|
|
main();
|