keystonejs / keystone

The most powerful headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
8.98k stars 1.13k forks source link

Add `context.transaction` for interactive Prisma transactions when using a Keystone `context` #9122

Closed dcousens closed 2 months ago

dcousens commented 2 months ago

This pull request adds context.transaction for running interactive Prisma transactions through a Keystone context. An example has been added in examples/transactions/schema.ts that shows how you might use this functionality in a custom GraphQL mutation.

This functionality is the bare-minimum approach to adding transactions for now, but future work will focus on how we can integrate transactions into hooks and other Keystone operations more fluently.

codesandbox-ci[bot] commented 2 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b276fb4074e219695715fc43b8b630f6d1cabaac:

Sandbox Source
@keystone-6/sandbox Configuration