@@ -85,53 +85,44 @@ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
8585
8686var main = exports . main = function ( ) {
8787 var _ref = ( 0 , _asyncToGenerator3 . default ) ( /*#__PURE__*/ _regenerator2 . default . mark ( function _callee ( event , context , callback ) {
88- var data , params , result ;
88+ var params , result ;
8989 return _regenerator2 . default . wrap ( function _callee$ ( _context ) {
9090 while ( 1 ) {
9191 switch ( _context . prev = _context . next ) {
9292 case 0 :
93- data = JSON . parse ( event . body ) ;
9493 params = {
9594 TableName : "notes" ,
96- // 'Key' defines the partition key and sort key of the item to be updated
95+ // 'Key' defines the partition key and sort key of the item to be removed
9796 // - 'userId': Identity Pool identity id of the authenticated user
9897 // - 'noteId': path parameter
9998 Key : {
10099 userId : event . requestContext . identity . cognitoIdentityId ,
101100 noteId : event . pathParameters . id
102- } ,
103- // 'UpdateExpression' defines the attributes to be updated
104- // 'ExpressionAttributeValues' defines the value in the update expression
105- UpdateExpression : "SET content = :content, attachment = :attachment" ,
106- ExpressionAttributeValues : {
107- ":attachment" : data . attachment ? data . attachment : null ,
108- ":content" : data . content ? data . content : null
109- } ,
110- ReturnValues : "ALL_NEW"
101+ }
111102 } ;
112- _context . prev = 2 ;
113- _context . next = 5 ;
114- return dynamoDbLib . call ( "update " , params ) ;
103+ _context . prev = 1 ;
104+ _context . next = 4 ;
105+ return dynamoDbLib . call ( "delete " , params ) ;
115106
116- case 5 :
107+ case 4 :
117108 result = _context . sent ;
118109
119110 callback ( null , ( 0 , _responseLib . success ) ( { status : true } ) ) ;
120- _context . next = 12 ;
111+ _context . next = 11 ;
121112 break ;
122113
123- case 9 :
124- _context . prev = 9 ;
125- _context . t0 = _context [ "catch" ] ( 2 ) ;
114+ case 8 :
115+ _context . prev = 8 ;
116+ _context . t0 = _context [ "catch" ] ( 1 ) ;
126117
127118 callback ( null , ( 0 , _responseLib . failure ) ( { status : false } ) ) ;
128119
129- case 12 :
120+ case 11 :
130121 case "end" :
131122 return _context . stop ( ) ;
132123 }
133124 }
134- } , _callee , this , [ [ 2 , 9 ] ] ) ;
125+ } , _callee , this , [ [ 1 , 8 ] ] ) ;
135126 } ) ) ;
136127
137128 return function main ( _x , _x2 , _x3 ) {
0 commit comments