diff --git a/backend/src/document-processor/controllers/document-processor.controller.ts b/backend/src/document-processor/controllers/document-processor.controller.ts index 5648b25a..823f6f0f 100644 --- a/backend/src/document-processor/controllers/document-processor.controller.ts +++ b/backend/src/document-processor/controllers/document-processor.controller.ts @@ -165,7 +165,6 @@ export class DocumentProcessorController { return { success: true, reportId: report.id, - analysis: result.analysis, }; } catch (error: unknown) { this.logger.error( diff --git a/backend/src/iac/backend-stack.ts b/backend/src/iac/backend-stack.ts index 3478a662..2084d591 100644 --- a/backend/src/iac/backend-stack.ts +++ b/backend/src/iac/backend-stack.ts @@ -87,7 +87,7 @@ export class BackendStack extends cdk.Stack { // Add GSI for querying by createdAt reportsTable.addGlobalSecondaryIndex({ - indexName: 'userIdDateIndex', + indexName: 'userIdCreatedAtIndex', partitionKey: { name: 'userId', type: AttributeType.STRING, @@ -431,6 +431,13 @@ export class BackendStack extends cdk.Stack { }, }); + const processFileIntegration = new apigateway.Integration({ + type: apigateway.IntegrationType.HTTP_PROXY, + integrationHttpMethod: 'POST', + uri: `${serviceUrl}/api/document-processor/process-file`, + options: integrationOptions, + }); + // Define method options with authorization const methodOptions = { authorizer: authorizer, @@ -457,6 +464,14 @@ export class BackendStack extends cdk.Stack { }, }); + // Add POST method to process file + reportIdResource.addMethod('POST', processFileIntegration, { + ...methodOptions, + requestParameters: { + 'method.request.path.id': true, + }, + }); + // Add CORS to each resource separately - after methods have been created const corsOptions = { allowOrigins: ['*'],