Given the docs, I have created a batch put resolver for a given type/table, but wondering how another batch put resolver should be created.
Successfully created:
type Todo @model {
id: ID!
name: String!
description: String
}
type Mutation {
batchCreateTodo(todos: [BatchCreateTodo]): [Todo]
}
input BatchCreateTodo {
id: ID
name: String!
description: String
}
But let’s say I would like to create another batch put resolver/mutation, should this be done like:
type Mutation {
batchCreateTodo(todos: [BatchCreateTodo]): [Todo]
}
type OtherMutation {
...
}
Or like this:
type Mutation {
batchCreateTodo(todos: [BatchCreateTodo]): [Todo]
someOtherBatch(things: [BatchCreateThings]): [Things]
}
How would the cdk-stack.ts
for the second batch mutation know that it is for the Things
model? Is this the differentiated by the fieldName
/typeName
in the resolver?:
const resolver = new appsync.CfnResolver(this, "custom-resolver", {
apiId: cdk.Fn.ref(retVal.api.replaceWithAPIName.GraphQLAPIIdOutput),
fieldName: "querySomething",
typeName: "Query", // Query | Mutation | Subscription
requestMappingTemplate: requestVTL,
responseMappingTemplate: responseVTL,
dataSourceName: "TodoTable" // DataSource name
})