Type: AWS::AppSync::Resolver Properties: ApiId: !GetAtt AppSyncAPI.ApiId TypeName: "Mutation" FieldName: "batchDeleteMaterial" DataSourceName: !GetAtt AppSyncDynamoDBMaterialSource.Name RequestMappingTemplate: | #set($ids = []) #foreach($id in $ctx.args.input.id) #set($map = {}) $util.qr($map.put("owner", $ctx.identity.sub)) $util.qr($map.put("sort", $id)) $util.qr($ids.add($util.dynamodb.toMapValues($map))) #end { "version" : "2018-05-29", "operation" : "BatchDeleteItem", "tables" : { "${self:provider.environment.MATERIAL_TABLE}": $util.toJson($ids) } } ResponseMappingTemplate: | #if( $ctx.error ) $util.error($ctx.error.message, $ctx.error.type) #else $util.toJson($ctx.result.data.${self:provider.environment.MATERIAL_TABLE}) #end