Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. {
  2. "id": "d7913a57-f458-4b81-8d6e-10f81e2b1dc2",
  3. "firstName": "John",
  4. "lastName": "Doe",
  5. "email": "johndoe@gmail.com",
  6. "companies" : [
  7. {
  8. "companyId": "6059be51-1e66-4f3a-9c8f-ced3bc89d562",
  9. "createdAt": 321321,
  10. "histories": [
  11. {
  12. "companyHistoryId": "dc9d1a57-fb82-4c25-a6cf-d27dfe114f8f",
  13. "content": "Company A was created.",
  14. "createdAt": 321321,
  15. "createdBy": "d7913a57-f458-4b81-8d6e-10f81e2b1dc2"
  16. }
  17. ],
  18. },
  19. ]
  20. }
  21.  
  22. {
  23. "version" : "2017-02-28",
  24. "operation" : "UpdateItem",
  25. "key" : {
  26. "id": { "S": "${context.arguments.id}" },
  27. },
  28. "update" : {
  29. "expression" : "SET companies = list_append(if_not_exists(companies, :emptyList), :newCompany)",
  30. "expressionValues" : {
  31. ":emptyList": { "L" : [] },
  32. ":newCompany" : { "L" : [
  33. { "M": {
  34. "name": { "S" : "${context.arguments.name}" },
  35. "createdAt": { "N" : "${context.arguments.createdAt}" },
  36. "companyId": { "S": "$util.autoId()" },
  37. "isActive": { "BOOL" : true },
  38. "histories": { "L": [
  39. { "M": {
  40. "companyHistoryId": { "S": "$util.autoId()" },
  41. "content" : { "S" : "${context.arguments.name} was created." },
  42. "createdAt": { "N" : "${context.arguments.createdAt}" },
  43. "createdBy": { "S": "${context.arguments.id}" }
  44. }}
  45. ] }
  46. }}
  47. ] },
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement