Complete mail signal automation with Telegram notifications and content analysis
This commit is contained in:
30
scratch/check_logs.ts
Normal file
30
scratch/check_logs.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { prisma } from "../lib/prisma";
|
||||
|
||||
async function checkDb() {
|
||||
try {
|
||||
console.log("--- Notification Logs ---");
|
||||
const nLogs = await prisma.notificationLog.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 5
|
||||
});
|
||||
console.log(JSON.stringify(nLogs, null, 2));
|
||||
|
||||
console.log("\n--- System Logs ---");
|
||||
const sLogs = await prisma.systemLog.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 5
|
||||
});
|
||||
console.log(JSON.stringify(sLogs, null, 2));
|
||||
|
||||
console.log("\n--- Mailbox Mappings ---");
|
||||
const mappings = await prisma.mailboxMapping.findMany();
|
||||
console.log(JSON.stringify(mappings, null, 2));
|
||||
|
||||
} catch (error) {
|
||||
console.error("DB Check failed:", error);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
checkDb();
|
||||
20
scratch/test_db.ts
Normal file
20
scratch/test_db.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Client } from 'pg';
|
||||
import 'dotenv/config';
|
||||
|
||||
async function testConnection() {
|
||||
const connectionString = process.env.DATABASE_URL;
|
||||
const client = new Client({ connectionString });
|
||||
|
||||
try {
|
||||
console.log("Connecting to:", connectionString?.split('@')[1]);
|
||||
await client.connect();
|
||||
console.log("Connected successfully!");
|
||||
const res = await client.query('SELECT NOW()');
|
||||
console.log("Current time from DB:", res.rows[0]);
|
||||
await client.end();
|
||||
} catch (err) {
|
||||
console.error("Connection error:", err.message);
|
||||
}
|
||||
}
|
||||
|
||||
testConnection();
|
||||
Reference in New Issue
Block a user