New feature: users can re-queue findings from a rejected FP submission back into the Ivanti todo queue under a different workflow type (FP, Archer, CARD, GRANITE, or DECOM). Primary use case is when an FP is rejected with a recommendation to submit an Archer risk acceptance. Backend: - New migration: add requeued_at column to ivanti_fp_submissions - New endpoint: POST /api/ivanti/fp-workflow/submissions/:id/requeue - Validates workflow_type and vendor (required for FP/Archer/DECOM) - Creates new pending queue items from original finding data - Marks submission as requeued (prevents double re-queue) - Audit logs the action Frontend (ReportingPage.js): - RequeueConfirmDialog component with workflow type selector and vendor input - Re-queue Findings button in Edit FP Modal header (rejected submissions only) - Already re-queued label when submission.requeued_at is set - Success notification on completion
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
// Run all Postgres-compatible migrations in order.
|
|
// Each migration is idempotent (safe to re-run).
|
|
// Used by CI/CD pipeline during deploy to ensure schema is up to date.
|
|
//
|
|
// Usage: cd backend && node migrations/run-all.js
|
|
|
|
const { execSync } = require('child_process');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const MIGRATIONS_DIR = __dirname;
|
|
|
|
// Only run migrations that use the Postgres pool (not legacy SQLite ones).
|
|
// Add new migrations to this list as they're created.
|
|
const POSTGRES_MIGRATIONS = [
|
|
'add_decom_workflow_type.js',
|
|
'add_fp_submissions_dismissed.js',
|
|
'add_fp_submissions_requeued_at.js',
|
|
'add_vcl_reporting_columns.js',
|
|
'add_vcl_vertical_metadata.js',
|
|
];
|
|
|
|
async function runAll() {
|
|
console.log(`[Migrations] Running ${POSTGRES_MIGRATIONS.length} Postgres migration(s)...`);
|
|
let succeeded = 0;
|
|
let failed = 0;
|
|
|
|
for (const file of POSTGRES_MIGRATIONS) {
|
|
const fullPath = path.join(MIGRATIONS_DIR, file);
|
|
if (!fs.existsSync(fullPath)) {
|
|
console.error(` [FAIL] ${file}: file not found`);
|
|
failed++;
|
|
continue;
|
|
}
|
|
|
|
try {
|
|
console.log(` [run] ${file}`);
|
|
execSync(`node ${fullPath}`, {
|
|
cwd: path.join(MIGRATIONS_DIR, '..'),
|
|
stdio: 'inherit',
|
|
timeout: 30000,
|
|
});
|
|
succeeded++;
|
|
} catch (err) {
|
|
console.error(` [FAIL] ${file}: exit code ${err.status}`);
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
console.log(`[Migrations] Done: ${succeeded} applied, ${failed} failed`);
|
|
if (failed > 0) process.exit(1);
|
|
}
|
|
|
|
runAll();
|