Skip to content

Commit

Permalink
customPartitionKey attribute name change
Browse files Browse the repository at this point in the history
  • Loading branch information
sundersc committed Oct 31, 2022
1 parent 0a41104 commit 968c63f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2138,8 +2138,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Test\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -2223,8 +2223,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -2434,8 +2434,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $Conditions )
#if( $keyConditionExprNames )
Expand Down Expand Up @@ -2856,8 +2856,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Item\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -2941,8 +2941,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -3158,8 +3158,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true,
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true,
\\"_version\\": $util.defaultIfNull($args.input[\\"_version\\"], 0)
} )
#if( $Conditions )
Expand Down Expand Up @@ -5542,8 +5542,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Item\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -5627,8 +5627,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -5843,8 +5843,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"orderId\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"orderId\\",
\\"populateIndexFields\\": true
} )
#if( $Conditions )
#if( $keyConditionExprNames )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Test\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -134,8 +134,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -350,8 +350,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $Conditions )
#if( $keyConditionExprNames )
Expand Down Expand Up @@ -701,8 +701,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Test\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -786,8 +786,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -997,8 +997,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"email\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"email\\",
\\"populateIndexFields\\": true
} )
#if( $Conditions )
#if( $keyConditionExprNames )
Expand Down Expand Up @@ -1850,8 +1850,8 @@ $util.qr($mergedValues.put(\\"__typename\\", \\"Test\\"))
\\"operation\\": \\"PutItem\\",
\\"attributeValues\\": $util.dynamodb.toMapValues($mergedValues),
\\"condition\\": $condition,
\\"customPrimaryKey\\": \\"status\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"status\\",
\\"populateIndexFields\\": true
} )
#if( $args.condition )
$util.qr($ctx.stash.conditions.add($args.condition))
Expand Down Expand Up @@ -1935,8 +1935,8 @@ $util.qr($ctx.stash.metadata.put(\\"modelObjectKey\\", {
#set( $DeleteRequest = {
\\"version\\": \\"2018-05-29\\",
\\"operation\\": \\"DeleteItem\\",
\\"customPrimaryKey\\": \\"status\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"status\\",
\\"populateIndexFields\\": true
} )
#if( $ctx.stash.metadata.modelObjectKey )
#set( $Key = $ctx.stash.metadata.modelObjectKey )
Expand Down Expand Up @@ -2146,8 +2146,8 @@ $util.qr($update.put(\\"expression\\", \\"$expression\\"))
\\"operation\\": \\"UpdateItem\\",
\\"key\\": $Key,
\\"update\\": $update,
\\"customPrimaryKey\\": \\"status\\",
\\"populateGSIFields\\": true
\\"customPartitionKey\\": \\"status\\",
\\"populateIndexFields\\": true
} )
#if( $Conditions )
#if( $keyConditionExprNames )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ export const generateUpdateRequestTemplate = (modelName: string, isSyncEnabled:
key: ref('Key'),
update: ref('update'),
...(hasCustomPrimaryKey && {
customPrimaryKey: str(`${partitionKey}`),
populateGSIFields: raw(`${hasCustomPrimaryKey}`),
customPartitionKey: str(`${partitionKey}`),
populateIndexFields: raw(`${hasCustomPrimaryKey}`),
}),
...(isSyncEnabled && { _version: ref('util.defaultIfNull($args.input["_version"], 0)') }),
}),
Expand Down Expand Up @@ -187,8 +187,8 @@ export const generateCreateRequestTemplate = (modelName: string, modelIndexField
attributeValues: methodCall(ref('util.dynamodb.toMapValues'), ref('mergedValues')),
condition: ref('condition'),
...(hasCustomPrimaryKey && {
customPrimaryKey: str(`${partitionKey}`),
populateGSIFields: raw(`${hasCustomPrimaryKey}`),
customPartitionKey: str(`${partitionKey}`),
populateIndexFields: raw(`${hasCustomPrimaryKey}`),
}),
}),
),
Expand Down Expand Up @@ -273,8 +273,8 @@ export const generateDeleteRequestTemplate = (isSyncEnabled: boolean, hasCustomP
version: str('2018-05-29'),
operation: str('DeleteItem'),
...(hasCustomPrimaryKey && {
customPrimaryKey: str(`${partitionKey}`),
populateGSIFields: raw(`${hasCustomPrimaryKey}`),
customPartitionKey: str(`${partitionKey}`),
populateIndexFields: raw(`${hasCustomPrimaryKey}`),
}),
}),
),
Expand Down

0 comments on commit 968c63f

Please sign in to comment.