-
The spec indicates that a mutation is meant to model the "write and then fetch" operation. However, I have a use case in which I need to perform an action on the server without writing data directly to the database. The operation should trigger a call to a third party API to send an email. Is it appropriate to use a mutation for this use case? If not, is another operation more appropriate? I can't imagine there exists a framework for API communication that doesn't allow for this scenario... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, mutations should be used in any case where a side effect takes place. GraphQL does not relate to databases or any particular storage or business logic technology. It is indifferent to where the side effect (or "write") takes place, only that it should be triggered from a mutation field. |
Beta Was this translation helpful? Give feedback.
Yes, mutations should be used in any case where a side effect takes place. GraphQL does not relate to databases or any particular storage or business logic technology. It is indifferent to where the side effect (or "write") takes place, only that it should be triggered from a mutation field.