import paramiko
import requests

c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('160.187.143.253', username='root', password=';ur7n)LC1BQ;')

script = """
import { db } from './drizzle/db';
import { tenants, users } from './drizzle/schema';
import { eq } from 'drizzle-orm';

async function test() {
    const userData = await db.select().from(users).where(eq(users.email, 'keanu@pc24.id')).limit(1);
    console.log(JSON.stringify(userData[0]));
    process.exit(0);
}
test();
"""

# Let's write a node script that simulates the exact Next.js API call!
# Next.js API routes are handled by the running server.
# We can bypass this by just curling the local IAM port!
curl_script = """
import http from 'http';
const options = {
  hostname: 'localhost',
  port: 3000,
  path: '/api/auth/quantum_token',
  method: 'GET',
  headers: {
    // We need to pass the JWT cookie for Keanu!
  }
};
"""
# Better idea: Just look at the logs if I inject a console.log into the route.ts!
c.close()
