Skip to content

Commit 52e5e41

Browse files
committed
cleanup
1 parent 26bba3a commit 52e5e41

File tree

7 files changed

+13
-270
lines changed

7 files changed

+13
-270
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@typescript-eslint/parser": "^8.0.1",
4040
"@vitejs/plugin-react": "^4.3.1",
4141
"@vitest/ui": "^2.0.5",
42-
"aws-sdk-client-mock": "^4.0.1",
42+
"aws-sdk-client-mock": "^4.1.0",
4343
"concurrently": "^9.1.2",
4444
"cross-env": "^7.0.3",
4545
"esbuild": "^0.23.0",

src/api/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { STSClient, GetCallerIdentityCommand } from "@aws-sdk/client-sts";
2121
import NodeCache from "node-cache";
2222
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
2323
import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
24-
import { SESClient } from "@aws-sdk/client-ses";
2524
import mobileWalletRoute from "./routes/mobileWallet.js";
2625

2726
dotenv.config();
@@ -37,10 +36,6 @@ async function init() {
3736
region: genericConfig.AwsRegion,
3837
});
3938

40-
const sesClient = new SESClient({
41-
region: genericConfig.AwsRegion,
42-
});
43-
4439
const app: FastifyInstance = fastify({
4540
logger: {
4641
level: process.env.LOG_LEVEL || "info",
@@ -88,7 +83,6 @@ async function init() {
8883
app.nodeCache = new NodeCache({ checkperiod: 30 });
8984
app.dynamoClient = dynamoClient;
9085
app.secretsManagerClient = secretsManagerClient;
91-
app.sesClient = sesClient;
9286
app.addHook("onRequest", (req, _, done) => {
9387
req.startTime = now();
9488
const hostname = req.hostname;

src/api/sqs/handlers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const emailMembershipPassHandler: SQSHandlerFunction<
2323
const clients = {
2424
smClient: new SecretsManagerClient(commonConfig),
2525
dynamoClient: new DynamoDBClient(commonConfig),
26-
sesClient: new SESClient(commonConfig),
2726
};
2827
const entraIdToken = await getEntraIdToken(
2928
clients,
@@ -46,8 +45,8 @@ export const emailMembershipPassHandler: SQSHandlerFunction<
4645
if (runEnvironment === "dev" && email === "[email protected]") {
4746
return;
4847
}
49-
await clients.sesClient.send(emailCommand);
50-
return;
48+
const sesClient = new SESClient(commonConfig);
49+
return await sesClient.send(emailCommand);
5150
};
5251

5352
export const pingHandler: SQSHandlerFunction<

src/api/sqs/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import { z, ZodError } from "zod";
1414
import pino from "pino";
1515
import { emailMembershipPassHandler, pingHandler } from "./handlers.js";
1616
import { ValidationError } from "../../common/errors/index.js";
17-
import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
18-
import { SESClient } from "@aws-sdk/client-ses";
19-
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
2017
import { RunEnvironment } from "../../common/roles.js";
2118
import { environmentConfig } from "../../common/config.js";
2219

@@ -28,7 +25,7 @@ export type SQSHandlerFunction<T extends AvailableSQSFunctions> = (
2825
payload: z.infer<(typeof sqsPayloadSchemas)[T]>["payload"],
2926
metadata: SQSMessageMetadata,
3027
logger: pino.Logger,
31-
) => Promise<void>;
28+
) => Promise<any>;
3229

3330
const handlers: SQSFunctionPayloadTypes = {
3431
[AvailableSQSFunctions.EmailMembershipPass]: emailMembershipPassHandler,

src/api/types.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { ConfigType } from "../common/config.js";
55
import NodeCache from "node-cache";
66
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
77
import { SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
8-
import { SESClient } from "@aws-sdk/client-ses";
98
import { SQSClient } from "@aws-sdk/client-sqs";
9+
1010
declare module "fastify" {
1111
interface FastifyInstance {
1212
authenticate: (
@@ -27,7 +27,6 @@ declare module "fastify" {
2727
environmentConfig: ConfigType;
2828
nodeCache: NodeCache;
2929
dynamoClient: DynamoDBClient;
30-
sesClient: SESClient;
3130
sqsClient?: SQSClient;
3231
secretsManagerClient: SecretsManagerClient;
3332
}

tests/unit/sqs/emailMembershipPass.test.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)