Skip to content

Commit

Permalink
fix(api-page-builder-so-ddb-es): add missing GSI index definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed May 16, 2023
1 parent d6a257e commit d3f7b13
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/api-page-builder-so-ddb-es/src/definitions/table.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TableModifier } from "~/types";
import { DocumentClient } from "aws-sdk/clients/dynamodb";
import { Table } from "dynamodb-toolbox";
import { DocumentClient } from "aws-sdk/clients/dynamodb";
import { TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
import { TableModifier } from "~/types";

interface Params {
table?: TableModifier;
Expand All @@ -12,7 +12,13 @@ export const createTable = ({ table, documentClient }: Params): Table => {
name: process.env.DB_PAGE_BUILDER || (process.env.DB_TABLE as string),
partitionKey: "PK",
sortKey: "SK",
DocumentClient: documentClient
DocumentClient: documentClient,
indexes: {
GSI1: {
partitionKey: "GSI1_PK",
sortKey: "GSI1_SK"
}
}
};

const config = typeof table === "function" ? table(tableConfig) : tableConfig;
Expand Down

0 comments on commit d3f7b13

Please sign in to comment.