From a403bc204fc9e19acf26eaa96dca8b8d0a2f776e Mon Sep 17 00:00:00 2001 From: Mark Slowey Date: Mon, 17 Aug 2026 09:39:16 +0100 Subject: [PATCH] add request and toUpdate context --- lambdas/supplier-allocator/src/handler/allocation-config.ts | 5 +++++ lambdas/upsert-letter/src/handler/upsert-handler.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lambdas/supplier-allocator/src/handler/allocation-config.ts b/lambdas/supplier-allocator/src/handler/allocation-config.ts index f9e7f92d1..1f383645e 100644 --- a/lambdas/supplier-allocator/src/handler/allocation-config.ts +++ b/lambdas/supplier-allocator/src/handler/allocation-config.ts @@ -81,11 +81,16 @@ export async function preferredSupplierPack( packSpecificationIds: string[], deps: Deps, ): Promise { + // Constraints const eligiblePacks: string[] = await filterPacksForLetter( letterEvent, packSpecificationIds, deps, ); + + // No eligible packs -> REJECTED + + // Check can a supplier fulfil the pack const preferredSupplierPacks: SupplierPack[] = await getPreferredSupplierPacks(eligiblePacks, suppliers, deps); const preferredPack: PackSpecification = await getPackSpecification( diff --git a/lambdas/upsert-letter/src/handler/upsert-handler.ts b/lambdas/upsert-letter/src/handler/upsert-handler.ts index fa49adb05..6baff1acb 100644 --- a/lambdas/upsert-letter/src/handler/upsert-handler.ts +++ b/lambdas/upsert-letter/src/handler/upsert-handler.ts @@ -56,6 +56,8 @@ function getOperationFromType(type: string): UpsertOperation { eventId: preparedRequest.id, letterId: letterToInsert.id, supplierId: letterToInsert.supplierId, + letterInsertRequest: request, + letterToInsert: letterToInsert, }); // emit success metric emitIndividualMetric( @@ -99,6 +101,8 @@ function getOperationFromType(type: string): UpsertOperation { eventId: supplierEvent.id, letterId: letterToUpdate.id, supplierId: letterToUpdate.supplierId, + letterUpdateRequest: request, + letterToUpdate: letterToUpdate, }); emitIndividualMetric( deps.logger,