@@ -6,23 +6,21 @@ export const main = handler(async (event, context) => {
66 const params = {
77 TableName : process . env . tableName ,
88 // 'Key' defines the partition key and sort key of the item to be updated
9- // - 'userId': Identity Pool identity id of the authenticated user
10- // - 'noteId': path parameter
119 Key : {
12- userId : event . requestContext . identity . cognitoIdentityId ,
13- noteId : event . pathParameters . id
10+ userId : event . requestContext . identity . cognitoIdentityId , // The id of the author
11+ noteId : event . pathParameters . id , // The id of the note from the path
1412 } ,
1513 // 'UpdateExpression' defines the attributes to be updated
1614 // 'ExpressionAttributeValues' defines the value in the update expression
1715 UpdateExpression : "SET content = :content, attachment = :attachment" ,
1816 ExpressionAttributeValues : {
1917 ":attachment" : data . attachment || null ,
20- ":content" : data . content || null
18+ ":content" : data . content || null ,
2119 } ,
2220 // 'ReturnValues' specifies if and how to return the item's attributes,
2321 // where ALL_NEW returns all attributes of the item after the update; you
2422 // can inspect 'result' below to see how it works with different settings
25- ReturnValues : "ALL_NEW"
23+ ReturnValues : "ALL_NEW" ,
2624 } ;
2725
2826 await dynamoDb . update ( params ) ;
0 commit comments