@@ -400,6 +400,9 @@ export class BackendStack extends cdk.Stack {
400400 // Create the 'status' resource under ':id'
401401 const documentProcessorResource = apiResource . addResource ( 'document-processor' ) ;
402402 const processFileResource = documentProcessorResource . addResource ( 'process-file' ) ;
403+ // Add report-status/:reportId resource under document-processor
404+ const reportStatusDPResource = documentProcessorResource . addResource ( 'report-status' ) ;
405+ const reportStatusDPIdResource = reportStatusDPResource . addResource ( '{reportId}' ) ;
403406
404407 // Define integration options once for reuse
405408 const integrationOptions = {
@@ -467,6 +470,19 @@ export class BackendStack extends cdk.Stack {
467470 options : integrationOptions ,
468471 } ) ;
469472
473+ // Integration for document-processor/report-status/{reportId}
474+ const getReportStatusDPIntegration = new apigateway . Integration ( {
475+ type : apigateway . IntegrationType . HTTP_PROXY ,
476+ integrationHttpMethod : 'GET' ,
477+ uri : `${ serviceUrl } /api/document-processor/report-status/{reportId}` ,
478+ options : {
479+ ...integrationOptions ,
480+ requestParameters : {
481+ 'integration.request.path.reportId' : 'method.request.path.reportId' ,
482+ } ,
483+ } ,
484+ } ) ;
485+
470486 // Define method options with authorization
471487 const methodOptions = {
472488 authorizer : authorizer ,
@@ -495,6 +511,13 @@ export class BackendStack extends cdk.Stack {
495511
496512 // Add POST method to process file
497513 processFileResource . addMethod ( 'POST' , processFileIntegration , methodOptions ) ;
514+ // Add GET method to document-processor/report-status/{reportId}
515+ reportStatusDPIdResource . addMethod ( 'GET' , getReportStatusDPIntegration , {
516+ ...methodOptions ,
517+ requestParameters : {
518+ 'method.request.path.reportId' : true ,
519+ } ,
520+ } ) ;
498521
499522 // Add CORS to each resource separately - after methods have been created
500523 const corsOptions = {
@@ -534,6 +557,11 @@ export class BackendStack extends cdk.Stack {
534557 ...corsOptions ,
535558 allowCredentials : false ,
536559 } ) ;
560+ // Add CORS to new resource
561+ reportStatusDPIdResource . addCorsPreflight ( {
562+ ...corsOptions ,
563+ allowCredentials : false ,
564+ } ) ;
537565
538566 // Configure Gateway Responses to add CORS headers to error responses
539567 const gatewayResponseTypes = [
0 commit comments