From ec37636f4e286ae92461865bba4aa23492e8ab04 Mon Sep 17 00:00:00 2001 From: naathanbrown Date: Tue, 12 Nov 2024 10:40:35 +0000 Subject: [PATCH] feat(cb2-14394): create temp recalls lambda for cache testing --- src/handler/recalls.ts | 15 ++++++++------- src/handler/recallsTemp.ts | 17 +++++++++++++++++ template.yml | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 src/handler/recallsTemp.ts diff --git a/src/handler/recalls.ts b/src/handler/recalls.ts index a81c45ef..629709a4 100644 --- a/src/handler/recalls.ts +++ b/src/handler/recalls.ts @@ -1,13 +1,14 @@ +import { SecretsManager } from '@dvsa/aws-utilities/classes/secrets-manager-client'; +import { getProfile } from '@dvsa/cvs-feature-flags/profiles/vtx'; +import { EnvironmentVariables } from '@dvsa/cvs-microservice-common/classes/misc/env-vars'; import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda"; +import { env } from "process"; +import { motRecalls } from "../models/motRecalls"; +import { recallSecret } from "../models/recallSecret"; +import { ERRORS } from "../util/enum"; +import { formatErrorMessage } from "../util/errorMessage"; import { addHttpHeaders } from "../util/httpHeaders"; import logger from "../util/logger"; -import { getProfile } from '@dvsa/cvs-feature-flags/profiles/vtx'; -import { motRecalls } from "../models/motRecalls"; -import { SecretsManager } from '@dvsa/aws-utilities/classes/secrets-manager-client'; -import { EnvironmentVariables } from '@dvsa/cvs-microservice-common/classes/misc/env-vars'; -import {formatErrorMessage} from "../util/errorMessage"; -import {ERRORS} from "../util/enum"; -import {recallSecret} from "../models/recallSecret"; const cache: Map> = new Map(); diff --git a/src/handler/recallsTemp.ts b/src/handler/recallsTemp.ts new file mode 100644 index 00000000..9bd4156c --- /dev/null +++ b/src/handler/recallsTemp.ts @@ -0,0 +1,17 @@ +import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda"; +import { addHttpHeaders } from "../util/httpHeaders"; +import logger from "../util/logger"; + +export const handler = async (event: APIGatewayProxyEvent): Promise => { + logger.info('Recalls end point called'); + + const vin: string = decodeURIComponent(event.pathParameters?.vin as string); + const time = new Date(); + + const returnValue = vin + ' - ' + time.toISOString(); + + return addHttpHeaders({ + statusCode: 200, + body: JSON.stringify(returnValue), + }); + }; \ No newline at end of file diff --git a/template.yml b/template.yml index ace9ebea..6191bfd4 100644 --- a/template.yml +++ b/template.yml @@ -172,7 +172,7 @@ Resources: Type: 'AWS::Serverless::Function' Properties: CodeUri: src/handler/ - Handler: recalls.handler + Handler: recallsTemp.handler Runtime: nodejs18.x Events: GetRecallsApi: