mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 07:52:10 +01:00
feat: comprehensive security and architecture improvements
- Add Zod validation schemas with strong password requirements (12+ chars, complexity) - Implement rate limiting for authentication endpoints (registration, password reset) - Remove duplicate MetricCard component, consolidate to ui/metric-card.tsx - Update README.md to use pnpm commands consistently - Enhance authentication security with 12-round bcrypt hashing - Add comprehensive input validation for all API endpoints - Fix security vulnerabilities in user registration and password reset flows 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,78 +1,87 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { ProcessingStatusManager } from './lib/processingStatusManager';
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { ProcessingStatusManager } from "./lib/processingStatusManager";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function debugImportStatus() {
|
||||
try {
|
||||
console.log('=== DEBUGGING PROCESSING STATUS (REFACTORED SYSTEM) ===\n');
|
||||
|
||||
console.log("=== DEBUGGING PROCESSING STATUS (REFACTORED SYSTEM) ===\n");
|
||||
|
||||
// Get pipeline status using the new system
|
||||
const pipelineStatus = await ProcessingStatusManager.getPipelineStatus();
|
||||
|
||||
|
||||
console.log(`Total Sessions: ${pipelineStatus.totalSessions}\n`);
|
||||
|
||||
|
||||
// Display status for each stage
|
||||
const stages = ['CSV_IMPORT', 'TRANSCRIPT_FETCH', 'SESSION_CREATION', 'AI_ANALYSIS', 'QUESTION_EXTRACTION'];
|
||||
|
||||
const stages = [
|
||||
"CSV_IMPORT",
|
||||
"TRANSCRIPT_FETCH",
|
||||
"SESSION_CREATION",
|
||||
"AI_ANALYSIS",
|
||||
"QUESTION_EXTRACTION",
|
||||
];
|
||||
|
||||
for (const stage of stages) {
|
||||
console.log(`${stage}:`);
|
||||
const stageData = pipelineStatus.pipeline[stage] || {};
|
||||
|
||||
|
||||
const pending = stageData.PENDING || 0;
|
||||
const inProgress = stageData.IN_PROGRESS || 0;
|
||||
const completed = stageData.COMPLETED || 0;
|
||||
const failed = stageData.FAILED || 0;
|
||||
const skipped = stageData.SKIPPED || 0;
|
||||
|
||||
|
||||
console.log(` PENDING: ${pending}`);
|
||||
console.log(` IN_PROGRESS: ${inProgress}`);
|
||||
console.log(` COMPLETED: ${completed}`);
|
||||
console.log(` FAILED: ${failed}`);
|
||||
console.log(` SKIPPED: ${skipped}`);
|
||||
console.log('');
|
||||
console.log("");
|
||||
}
|
||||
|
||||
|
||||
// Check Sessions vs SessionImports
|
||||
console.log('=== SESSION IMPORT RELATIONSHIP ===');
|
||||
console.log("=== SESSION IMPORT RELATIONSHIP ===");
|
||||
const sessionsWithImports = await prisma.session.count({
|
||||
where: { importId: { not: null } }
|
||||
where: { importId: { not: null } },
|
||||
});
|
||||
const totalSessions = await prisma.session.count();
|
||||
|
||||
|
||||
console.log(` Sessions with importId: ${sessionsWithImports}`);
|
||||
console.log(` Total sessions: ${totalSessions}`);
|
||||
|
||||
|
||||
// Show failed sessions if any
|
||||
const failedSessions = await ProcessingStatusManager.getFailedSessions();
|
||||
if (failedSessions.length > 0) {
|
||||
console.log('\n=== FAILED SESSIONS ===');
|
||||
failedSessions.slice(0, 10).forEach(failure => {
|
||||
console.log(` ${failure.session.import?.externalSessionId || failure.sessionId}: ${failure.stage} - ${failure.errorMessage}`);
|
||||
console.log("\n=== FAILED SESSIONS ===");
|
||||
failedSessions.slice(0, 10).forEach((failure) => {
|
||||
console.log(
|
||||
` ${failure.session.import?.externalSessionId || failure.sessionId}: ${failure.stage} - ${failure.errorMessage}`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
if (failedSessions.length > 10) {
|
||||
console.log(` ... and ${failedSessions.length - 10} more failed sessions`);
|
||||
console.log(
|
||||
` ... and ${failedSessions.length - 10} more failed sessions`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
console.log('\n✓ No failed sessions found');
|
||||
console.log("\n✓ No failed sessions found");
|
||||
}
|
||||
|
||||
|
||||
// Show what needs processing
|
||||
console.log('\n=== WHAT NEEDS PROCESSING ===');
|
||||
|
||||
console.log("\n=== WHAT NEEDS PROCESSING ===");
|
||||
|
||||
for (const stage of stages) {
|
||||
const stageData = pipelineStatus.pipeline[stage] || {};
|
||||
const pending = stageData.PENDING || 0;
|
||||
const failed = stageData.FAILED || 0;
|
||||
|
||||
|
||||
if (pending > 0 || failed > 0) {
|
||||
console.log(`• ${stage}: ${pending} pending, ${failed} failed`);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error debugging processing status:', error);
|
||||
console.error("Error debugging processing status:", error);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user