import { BullBoardRequest , ControllerHandlerReturnType , QueueJob , } from '../../typings/app' ; import { BaseAdapter } from '../queueAdapters/base' ; export function jobProvider ( next ) { return async ( req , queue ) : Promise < ControllerHandlerReturnType > => { const { jobId } = req . params ; const job = await queue . getJob ( jobId ) ; if ( ! job ) { return { status : 404 , body : { error : 'Job not found' , } , } ; } return next ( req , job ) ; } ; }