Wire the app, worker, and cleanup entry points onto Prisma Client

Task 4 rewrote src/db.js and src/jobs/jobRepository.js to use Prisma
instead of the hand-rolled mariadb pool. This updates every remaining
call site (app.js, server.js, worker.js, cleanup.js) and the 5 test
files that still referenced getPool/closePool/pool.query, so the app
and full test suite compile and run against Prisma Client.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 01:32:54 +02:00
co-authored by Claude Sonnet 5
parent 3a04da3180
commit 4c9fe8f616
9 changed files with 93 additions and 93 deletions
+7 -7
View File
@@ -5,34 +5,34 @@ import path from 'node:path';
import os from 'node:os';
import { Document, Paragraph, TextRun, Packer } from 'docx';
import { createApp } from '../../src/app.js';
import { getPool, closePool } from '../../src/db.js';
import { getPrismaClient, closePrismaClient } from '../../src/db.js';
import { loadConfig } from '../../src/config.js';
import { ensureStorageDirs } from '../../src/storage.js';
import { processPendingJobs } from '../../src/worker.js';
let app;
let pool;
let prisma;
let config;
beforeAll(async () => {
config = { ...loadConfig(), storageDir: await fs.mkdtemp(path.join(os.tmpdir(), 'converter-e2e-')) };
await ensureStorageDirs(config);
pool = getPool(config);
app = createApp(config, pool);
prisma = getPrismaClient(config);
app = createApp(config, prisma);
});
afterAll(async () => {
await closePool();
await closePrismaClient();
await fs.rm(config.storageDir, { recursive: true, force: true });
});
beforeEach(async () => {
await pool.query('DELETE FROM conversion_jobs');
await prisma.conversionJob.deleteMany();
});
async function waitForDone(id, maxAttempts = 20) {
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
await processPendingJobs(pool, config);
await processPendingJobs(prisma, config);
const response = await request(app).get(`/api/jobs/${id}`);
if (response.body.status === 'done' || response.body.status === 'failed') {
return response.body;