Skip to content

Commit 1402dc1

Browse files
stevebuxCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent b9d96ad commit 1402dc1

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

infrastructure/terraform/components/api/ddb_table_letter_queue.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resource "aws_dynamodb_table" "letter_queue" {
1212

1313
local_secondary_index {
1414
name = "queueSortOrder-index"
15-
range_key = "queueSortOrder-SK"
15+
range_key = "queueSortOrderSk"
1616
projection_type = "ALL"
1717
}
1818

@@ -27,7 +27,7 @@ resource "aws_dynamodb_table" "letter_queue" {
2727
}
2828

2929
attribute {
30-
name = "queueSortOrder-SK"
30+
name = "queueSortOrderSk"
3131
type = "S"
3232
}
3333

internal/datastore/src/letter-queue-repository.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export default class LetterQueueRepository {
3131
): Promise<PendingLetter> {
3232
// needs to be an ISO timestamp as Db sorts alphabetically
3333
const now = new Date().toISOString();
34-
const priority = String(insertPendingLetter.priority ?? 10);
34+
const priority = String(
35+
insertPendingLetter.priority ?? this.defaultPriority,
36+
);
3537
const queueSortOrderSk = `${priority.padStart(2, "0")}-${now}`;
3638
const pendingLetter: PendingLetter = {
3739
...insertPendingLetter,

lambdas/upsert-letter/src/handler/upsert-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type PreparedEvents = LetterRequestPreparedEventV2 | LetterRequestPreparedEvent;
2121
const SupplierSpecSchema = z.object({
2222
supplierId: z.string().min(1),
2323
specId: z.string().min(1),
24-
priority: z.int(),
24+
priority: z.int().min(0).max(99),
2525
});
2626

2727
type SupplierSpec = z.infer<typeof SupplierSpecSchema>;

0 commit comments

Comments
 (0)