strawberry-graphql/strawberry-django

Enable atomic nested mutations

开放

#628 创建于 2024年9月13日

 (3 条评论) (4 个反应) (0 位负责人)Python (152 个派生)auto 404
enhancementhelp wantedproposal

仓库指标

星标
 (496 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Strawberry supports serialization for nested mutations but Strawberry-Django doesn't seem to be able do it in an atomic way

Feature Request Type

  • New behavior

Description

In the below example, I expect these things to happen in an atomic way so that if a credit card charge fails we do have to go back out previous transactions.

I've seen similar offers from other libraries such as Prisma.

mutation (
  $createInvoice: CreateInvoiceInput!
  $chargeCreditCard: ChargeCreditCardInput!
  atomic: true
) {
  createInvoice: invoice {
    createInvoice(input: $createInvoice) {
      id
    }
  }

  chargeCreditCard: invoice {
    chargeCreditCard(input: $chargeCreditCard) {
      id
    }
  }
}

贡献者指南