Skip to content

Commit

Permalink
condirion create on item not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Oct 22, 2024
1 parent 29c8e96 commit 642c08d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/handlers/CreateEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export async function putEntity(entity: Entity): Promise<PutItemCommandOutput> {

const params: PutItemCommandInput = {
TableName: DDB_TABLE_NAME,
Item: marshall(item)
Item: marshall(item),
ConditionExpression: 'attribute_not_exists(pk) AND attribute_not_exists(sk)'
}

try {
Expand Down

0 comments on commit 642c08d

Please sign in to comment.