Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 3x 4x 1x | const { getActiveFlowId } = require('../shared/activeFlow')
const { requirePermission } = require('../utils/requirePermission')
const { getJob } = require('../utils/jobsTable')
const { buildExportJobView } = require('../utils/exportJobView')
function jsonResponse(statusCode, body) {
return {
statusCode,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
},
body: JSON.stringify(body)
}
}
async function getExportJobHandler(event) {
try {
const flowId = await getActiveFlowId(event)
Iif (!flowId) {
return jsonResponse(401, { error: 'Missing flow context' })
}
const jobId = event.pathParameters?.jobId
const job = await getJob(jobId)
if (!job || job.type !== 'export' || job.flowId !== flowId) {
return jsonResponse(404, { error: 'Export job not found' })
}
return jsonResponse(200, await buildExportJobView(job))
} catch (error) {
console.error('[get-export-job] Exception:', error.message, error.stack)
return jsonResponse(500, { error: 'Failed to get export job' })
}
}
exports.handler = requirePermission(getExportJobHandler, { permission: 'entities:list' })
|