feat: add auto-increment id, size/duration tracking, and soft cleanup to conversion_jobs
Rename the old CHAR(36) id to uuid (still used for public URLs and file naming) and add a real auto-increment id as the primary key. Track input/output file size and conversion duration per job. Cleanup no longer deletes rows; it marks cleaned_at and skips already-cleaned expired jobs on later runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import os from 'node:os';
|
||||
import { createApp } from '../../src/app.js';
|
||||
import { getPool, closePool } from '../../src/db.js';
|
||||
import { loadConfig } from '../../src/config.js';
|
||||
import { getJobById } from '../../src/jobs/jobRepository.js';
|
||||
import { getJobByUuid } from '../../src/jobs/jobRepository.js';
|
||||
import { ensureStorageDirs } from '../../src/storage.js';
|
||||
|
||||
let app;
|
||||
@@ -60,12 +60,13 @@ describe('POST /api/jobs', () => {
|
||||
expect(response.body.jobs[0].status).toBe('pending');
|
||||
expect(response.body.jobs[0].file).toBe('photo.png');
|
||||
|
||||
const job = await getJobById(pool, response.body.jobs[0].id);
|
||||
const job = await getJobByUuid(pool, response.body.jobs[0].id);
|
||||
expect(job.status).toBe('pending');
|
||||
expect(job.sourceFormat).toBe('png');
|
||||
expect(job.targetFormat).toBe('webp');
|
||||
expect(job.originalFilename).toBe('photo.png');
|
||||
expect(job.inputMimeType).toBe('image/png');
|
||||
expect(job.inputSizeBytes).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('rejects a file whose content does not match its extension, without failing the whole batch', async () => {
|
||||
|
||||
Reference in New Issue
Block a user