Closed pjsandwich closed 1 week ago
Hey @pjsandwich, Thank you for raising this. Yes, you can create multiple batch mutations using the same approach as batchCreateToDo
, with the TypeName
always being Mutation
in this case. Below is a sample code snippet for BatchCreateThings
.
type Mutation {
batchCreateTodo(todos: [BatchCreateTodo]): [Todo]
someOtherBatch(things: [BatchCreateThings]): [Things]
}
const thingsresolver = new appsync.CfnResolver(this, 'someOtherBatch', {
apiId: apiIdRef,
fieldName: 'someOtherBatch',
typeName: 'Mutation', // Mutation type
requestMappingTemplate: requestVTL,
responseMappingTemplate: responseVTL,
dataSourceName: 'ThingsTable', // DataSource name
});
Thank you @AnilMaktala , I will try this out and get back to you here
This works! Thanks @AnilMaktala
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Amplify CLI Version
12.12.6
Question
Which of these are the correct way to create more than one batch mutation with a custom cdk resolver?
Or
I see that the
typeName
field should beQuery | Mutation | Subscription
:But how should an additional batch mutation be added to the schema and does the
typeName
or the resolver code need to be adjusted in a certain way on the existing toDo resolver or the new resolver?