Skip to content

Commit b7e6fc6

Browse files
Add peer review suggestions
1 parent 8fcb28f commit b7e6fc6

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

infrastructure/terraform/components/api/module_lambda_get_letters.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ data "aws_iam_policy_document" "get_letters_lambda" {
6060
effect = "Allow"
6161

6262
actions = [
63-
"dynamodb:BatchGetItem",
6463
"dynamodb:GetItem",
65-
"dynamodb:Query",
66-
"dynamodb:Scan",
64+
"dynamodb:Query"
6765
]
6866

6967
resources = [

lambdas/api-handler/src/config/deps.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import pino from 'pino';
55
import { LetterRepository } from '../../../../internal/datastore';
66
import { lambdaEnv, LambdaEnv } from "../config/env";
77

8-
const BASE_TEN = 10;
9-
108
let singletonDeps: Deps | null = null;
119

1210
export type Deps = {
@@ -21,7 +19,7 @@ function createLetterRepository(log: pino.Logger, lambdaEnv: LambdaEnv): LetterR
2119
const docClient = DynamoDBDocumentClient.from(ddbClient);
2220
const config = {
2321
lettersTableName: lambdaEnv.LETTERS_TABLE_NAME,
24-
ttlHours: Number.parseInt(lambdaEnv.LETTER_TTL_HOURS, BASE_TEN),
22+
ttlHours: Number.parseInt(lambdaEnv.LETTER_TTL_HOURS)
2523
};
2624

2725
return new LetterRepository(docClient, log, config);

lambdas/api-handler/src/config/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const lambdaEnv: LambdaEnv = {
1414
DOWNLOAD_URL_TTL_SECONDS: getEnv('DOWNLOAD_URL_TTL_SECONDS')!
1515
};
1616

17-
function getEnv(name: string, required = true): string | undefined {
17+
function getEnv(name: string): string {
1818
const value = process.env[name];
19-
if (!value && required) {
19+
if (!value) {
2020
throw new Error(`Missing required env var: ${name}`);
2121
}
2222
return value;

0 commit comments

Comments
 (0)