Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. const params = {
  2. TableName: process.env.DYNAMODB_TABLE,
  3. Key: {
  4. id: event.pathParameters.id,
  5. },
  6. ExpressionAttributeNames: {
  7. '#todo_text': 'text',
  8. },
  9. ExpressionAttributeValues: {
  10. ':text': data.text,
  11. ':checked': data.checked,
  12. ':updatedAt': timestamp,
  13. },
  14. UpdateExpression: 'SET #todo_text = :text, checked = :checked, updatedAt = :updatedAt',
  15. ReturnValues: 'ALL_NEW',
  16. };
  17.  
  18. const params = {
  19. TableName: process.env.DYNAMODB_TABLE,
  20. Key: {
  21. id: event.pathParameters.id,
  22. },
  23. ExpressionAttributeNames: {
  24. '#user_name': 'name',
  25. },
  26. ExpressionAttributeValues: {
  27. ':name': data.name,
  28. ':email': data.email,
  29. ':username': data.username,
  30. ':password': data.password,
  31. ':checked': data.checked,
  32. ':updatedAt': timestamp,
  33. },
  34. UpdateExpression: 'SET #user_name = :name, email = :email, username = :username, password = :password, checked = :checked, updatedAt = :updatedAt',
  35. ReturnValues: 'ALL_NEW',
  36. };
  37.  
  38. $ cat test/user-1.json
  39. {
  40. "name": "Bob",
  41. "email": "bob@example.com",
  42. "username": "bob",
  43. "password": "adfdsfdsf",
  44. "checked": false
  45. }
  46.  
  47. $ cat test/user-1.json
  48. {
  49. "name": "Bob",
  50. "username": "bob-1",
  51. "checked": false
  52. }
  53.  
  54. $ curl -X PUT ${url}/${id} --data '@test/user-1.json'
  55. Couldn't fetch the user item.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement