Skip to content

Commit

Permalink
feat(cb2-14394): create temp recalls lambda for cache testing
Browse files Browse the repository at this point in the history
  • Loading branch information
naathanbrown committed Nov 12, 2024
1 parent aa11716 commit ec37636
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/handler/recalls.ts
Original file line number Diff line number Diff line change
@@ -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<string, Map<string, string>> = new Map();

Expand Down
17 changes: 17 additions & 0 deletions src/handler/recallsTemp.ts
Original file line number Diff line number Diff line change
@@ -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<APIGatewayProxyResult> => {
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),
});
};
2 changes: 1 addition & 1 deletion template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
CodeUri: src/handler/
Handler: recalls.handler
Handler: recallsTemp.handler
Runtime: nodejs18.x
Events:
GetRecallsApi:
Expand Down

0 comments on commit ec37636

Please sign in to comment.