fase(15): reporting module with pdf generation
This commit is contained in:
29
src/main.ts
29
src/main.ts
@@ -51,6 +51,10 @@ import { GetUserQuery } from './modules/auth/application/queries/GetUserQuery';
|
||||
import { ListOrgMembersQuery } from './modules/auth/application/queries/ListOrgMembersQuery';
|
||||
import { hashPassword, verifyPassword } from './modules/auth/infrastructure/auth/PasswordService';
|
||||
|
||||
// Reporting module
|
||||
import { KyselyReportRepository } from './modules/reporting/infrastructure/repositories/KyselyReportRepository';
|
||||
import { GenerateReportCommand } from './modules/reporting/application/commands/GenerateReportCommand';
|
||||
|
||||
// Job queue
|
||||
import { SQLiteJobQueue } from './jobs/SQLiteJobQueue';
|
||||
import { createExplorationJobHandler, EXPLORATION_JOB_TYPE } from './jobs/workers/ExplorationWorker';
|
||||
@@ -80,6 +84,7 @@ async function bootstrap(): Promise<void> {
|
||||
const sessionRepo = new KyselyCrawlSessionRepository(db);
|
||||
const stateRepo = new KyselyStateRepository(db);
|
||||
const findingRepo = new KyselyFindingRepository(db);
|
||||
const reportRepo = new KyselyReportRepository(db);
|
||||
const fuzzRepo = new InMemoryFuzzSessionRepository();
|
||||
|
||||
// Suppress unused warning for stateRepo — used by crawling infrastructure
|
||||
@@ -125,7 +130,19 @@ async function bootstrap(): Promise<void> {
|
||||
const getUserQuery = new GetUserQuery(userRepo);
|
||||
const listOrgMembersQuery = new ListOrgMembersQuery(orgRepo, userRepo);
|
||||
|
||||
// 11. HTTP server
|
||||
// 11. Reporting use cases
|
||||
const generateReport = new GenerateReportCommand(reportRepo, eventBus);
|
||||
|
||||
// 12. Job queue (created before HTTP server so it can be injected)
|
||||
const jobQueue = new SQLiteJobQueue(db, logger, config.jobs.pollIntervalMs);
|
||||
jobQueue.registerHandler(
|
||||
EXPLORATION_JOB_TYPE,
|
||||
createExplorationJobHandler({ sessionRepo, eventBus, logger }),
|
||||
);
|
||||
jobQueue.registerHandler(REPORT_JOB_TYPE, createReportJobHandler({ logger, reportRepository: reportRepo, findingRepository: findingRepo }));
|
||||
jobQueue.start();
|
||||
|
||||
// 13. HTTP server
|
||||
const app = createServer({
|
||||
config,
|
||||
logger,
|
||||
@@ -133,6 +150,7 @@ async function bootstrap(): Promise<void> {
|
||||
crawlingDeps: { startCrawl, stopCrawl, getSession, listSessions },
|
||||
findingsDeps: { getFinding, listFindings, findingStats, resolveFinding, enrichFinding },
|
||||
fuzzingDeps: { runFuzz, repository: fuzzRepo },
|
||||
reportingDeps: { generateReport, reportRepository: reportRepo, jobQueue },
|
||||
authDeps: {
|
||||
registerCommand,
|
||||
loginCommand,
|
||||
@@ -149,15 +167,6 @@ async function bootstrap(): Promise<void> {
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
|
||||
// 11. Job queue
|
||||
const jobQueue = new SQLiteJobQueue(db, logger, config.jobs.pollIntervalMs);
|
||||
jobQueue.registerHandler(
|
||||
EXPLORATION_JOB_TYPE,
|
||||
createExplorationJobHandler({ sessionRepo, eventBus, logger }),
|
||||
);
|
||||
jobQueue.registerHandler(REPORT_JOB_TYPE, createReportJobHandler({ logger }));
|
||||
jobQueue.start();
|
||||
|
||||
// 12. Socket.io + gateway
|
||||
const io = new SocketIOServer(httpServer, {
|
||||
cors: { origin: config.cors.origin, credentials: true },
|
||||
|
||||
Reference in New Issue
Block a user