This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version":"2017-02-28", | |
"operation":"GET", | |
"path":"/_count", | |
"params":{ | |
"body": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ "match": { "typeName": "FAVORITE" } }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version" : "2017-02-28", | |
"operation" : "Query", | |
"query" : { | |
"expression": "#typeName = :typeName", | |
"expressionNames": { | |
"#typeName": "typeName" | |
}, | |
"expressionValues" : { | |
":typeName" : $util.dynamodb.toDynamoDBJson("REVIEW") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Raise a GraphQL field error in case of a datasource invocation error | |
#if($ctx.error) | |
$util.error($ctx.error.message, $ctx.error.type) | |
#end | |
#set($result = {}) | |
$util.qr($result.put("nextToken",$ctx.prev.result.nextToken)) | |
$util.qr($result.put("items", $ctx.result.data.devRestaurantReviews)) | |
$util.toJson($result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($keys = []) | |
#foreach($id in ${ctx.prev.result.ids}) | |
#set($key = {}) | |
$util.qr($key.put("typeName", $util.dynamodb.toString("LOCATION"))) | |
$util.qr($key.put("id", $util.dynamodb.toString($id))) | |
$util.qr($keys.add($key)) | |
#end | |
{ | |
"version": "2018-05-29", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if($ctx.error) | |
$util.error($ctx.error.message, $ctx.error.type) | |
#end | |
#set($idList = []) | |
#foreach($item in $context.result.items) | |
$util.qr($idList.add($item.locationId)) | |
#end | |
#set($result = {}) | |
$util.qr($result.put("ids", $idList)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2018-05-29", | |
"operation" : "Query", | |
"query" : { | |
"expression": "typeName = :typeName", | |
"expressionValues" : { | |
":typeName" : $util.dynamodb.toDynamoDBJson("FAVORITE") | |
} | |
}, | |
"filter": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version" : "2018-05-29", | |
"operation" : "Query", | |
"query" : { | |
"expression": "typeName = :typeName", | |
"expressionValues" : { | |
":typeName" : $util.dynamodb.toDynamoDBJson("LOCATION"), | |
} | |
}, | |
"filter": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mappingTemplates: | |
- type: Mutation | |
field: markFavorite | |
request: Mutation-markFavorite-request.vtl | |
response: common-response.vtl | |
kind: PIPELINE | |
functions: | |
- getLocation | |
- storeFavorite | |
functionConfigurations: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Raise a GraphQL field error in case of a datasource invocation error | |
#if($ctx.error) | |
$util.error($ctx.error.message, $ctx.error.type) | |
#end | |
## Pass back the result from DynamoDB. ** | |
$util.toJson($context.prev.result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($id = $ctx.stash.get("locationId")+"-"+$context.stash.get("owner")) | |
{ | |
"operation": "PutItem", | |
"key": { | |
"id": $util.dynamodb.toDynamoDBJson($id), | |
"typeName": $util.dynamodb.toDynamoDBJson("FAVORITE") | |
}, | |
"attributeValues": { | |
"owner": $util.dynamodb.toDynamoDBJson($context.stash.get("owner")), | |
"locationId": $util.dynamodb.toDynamoDBJson($context.stash.get("locationId")) |