【发布时间】:2018-08-24 02:31:34
【问题描述】:
我正在使用带有 apollo 客户端的 graphQL、sequelize 和 nodejs。 我从 UI 发送的数据是以下形式的嵌套结构:
祖父母
家长
孩子
因此,祖父母可以有一个或多个父母,而父母可以有一个或多个孩子。
我正在尝试使用一个 GraphQL 突变更新我的 SQLite 数据库,该数据库是使用 sequelize 创建的。我能够创建具有扁平结构的突变:
schema.gql 文件内容 ->
type Mutation Family(
grandParentName: String,
grandParentHeight: String,
Parent: String,
)
但我想要一些类似
的东西type Mutation CreateNestedFamily(
grandParentName: String,
grandParentHeight: String,
Parent: CreateParent(
parentName: String,
parentHeight: String
child: CreateChild(
childName: String,
childHeight: String
)
)
)
但我不知道如何实现这一点,而且关于嵌套突变的 graphql 文档非常有限。
任何帮助将不胜感激!
【问题讨论】:
标签: node.js sequelize.js graphql apollo-client mutation