From b219f8395c94b3ff124fa468b2df3e5f1d4d561a Mon Sep 17 00:00:00 2001 From: Adam Refaey Date: Wed, 16 Apr 2025 22:46:15 +0200 Subject: [PATCH 1/3] Rename GSI from 'userIdDateIndex' to 'userIdCreatedAtIndex' for clarity --- backend/src/iac/backend-stack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/iac/backend-stack.ts b/backend/src/iac/backend-stack.ts index 3478a662..ee0ef80f 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, From b28ae023e9c05d255c4b60c61e9cd107e9ae3c3d Mon Sep 17 00:00:00 2001 From: Adam Refaey Date: Wed, 16 Apr 2025 22:49:51 +0200 Subject: [PATCH 2/3] Add HTTP proxy integration for file processing and POST method to reports resource --- backend/src/iac/backend-stack.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/src/iac/backend-stack.ts b/backend/src/iac/backend-stack.ts index ee0ef80f..2084d591 100644 --- a/backend/src/iac/backend-stack.ts +++ b/backend/src/iac/backend-stack.ts @@ -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: ['*'], From 874ba61521693a890d7d2d4b38baf09c1e9a7138 Mon Sep 17 00:00:00 2001 From: Adam Refaey Date: Wed, 16 Apr 2025 22:51:22 +0200 Subject: [PATCH 3/3] Remove analysis from report response in DocumentProcessorController --- .../controllers/document-processor.controller.ts | 1 - 1 file changed, 1 deletion(-) 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(