Skip to content

Commit 6a84ce6

Browse files
CCM-13372 - Update pk and sk values
1 parent 01c4ada commit 6a84ce6

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

infrastructure/terraform/components/api/ddb_table_supplier_configuration.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ resource "aws_dynamodb_table" "supplier-configuration" {
5252

5353
global_secondary_index {
5454
name = "packSpecificationId-index"
55-
hash_key = "PK"
55+
hash_key = "pk"
5656
range_key = "packSpecificationId"
5757
projection_type = "ALL"
5858
}

internal/datastore/src/__test__/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const createSupplierConfigTableCommand = new CreateTableCommand({
168168
{
169169
IndexName: "packSpecificationId-index",
170170
KeySchema: [
171-
{ AttributeName: "PK", KeyType: "HASH" }, // Partition key for GSI
171+
{ AttributeName: "pk", KeyType: "HASH" }, // Partition key for GSI
172172
{ AttributeName: "packSpecificationId", KeyType: "RANGE" }, // Sort key for GSI
173173
],
174174
Projection: {

internal/datastore/src/__test__/supplier-config-repository.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ describe("SupplierConfigRepository", () => {
273273
new PutCommand({
274274
TableName: dbContext.config.supplierConfigTableName,
275275
Item: {
276-
PK: "SUPPLIER_PACK",
277-
SK: supplierPackId,
276+
pk: "ENTITY#supplier-pack",
277+
sk: `ID#${supplierPackId}`,
278278
id: supplierPackId,
279279
packSpecificationId: packSpecId,
280280
supplierId,
@@ -311,8 +311,8 @@ describe("SupplierConfigRepository", () => {
311311
new PutCommand({
312312
TableName: dbContext.config.supplierConfigTableName,
313313
Item: {
314-
PK: "PACK_SPECIFICATION",
315-
SK: packSpecId,
314+
pk: "ENTITY#pack_specification",
315+
sk: `ID#${packSpecId}`,
316316
id: packSpecId,
317317
name: `Pack Specification ${packSpecId}`,
318318
createdAt: new Date().toISOString(),

internal/datastore/src/supplier-config-repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ export class SupplierConfigRepository {
112112
KeyConditionExpression: "#pk = :pk AND #packSpecId = :packSpecId",
113113
FilterExpression: "#status = :status AND #approval = :approval",
114114
ExpressionAttributeNames: {
115-
"#pk": "PK",
115+
"#pk": "pk",
116116
"#packSpecId": "packSpecificationId",
117117
"#status": "status",
118118
"#approval": "approval",
119119
},
120120
ExpressionAttributeValues: {
121-
":pk": "SUPPLIER_PACK",
121+
":pk": "ENTITY#supplier-pack",
122122
":packSpecId": packSpecId,
123123
":status": "PROD",
124124
":approval": "APPROVED",
@@ -133,7 +133,7 @@ export class SupplierConfigRepository {
133133
const result = await this.ddbClient.send(
134134
new GetCommand({
135135
TableName: this.config.supplierConfigTableName,
136-
Key: { PK: "PACK_SPECIFICATION", SK: packSpecId },
136+
Key: { pk: "ENTITY#pack_specification", sk: `ID#${packSpecId}` },
137137
}),
138138
);
139139
if (!result.Item) {

0 commit comments

Comments
 (0)